Multiple Use error.

Discussion about Schedules Direct grabber code and data formats.

Multiple Use error.

Postby Katharsys » Sat Sep 15, 2007 2:53 pm

Hi and thanks in advance if anyone can help me out with this.

With the changeover to SD, the package I was using kinda stopped. While it was good, I want to make one here that meets my needs - however, skills/knowledge of SOAP are lacking.

When trying to generate a Java client (after trying both XFire plugin to Eclipse and the built-in MyEclipse generation) from the only wsdl source I have been able to get ahold of from rmeden's post:


I end up with an error that reads: "Error generating services. Multiple usues not supported at this time". Has anyone else run across this error, and what is the correction?

--EDIT 09/15/07 16:53--
I am hoping to get this corrected before my free trial runs out...while I am going to subscrbe - just on sheer principle - it would be nice to have a working SOAP client before subscribing.
Katharsys
 
Posts: 2
Joined: Sat Sep 08, 2007 7:09 pm

Re: Multiple Use error.

Postby the_tom » Wed Sep 19, 2007 3:44 pm

Previously I edited the wsdl for use with Visual Studio (see this post: viewtopic.php?f=8&t=187#p1670, and others in that same thread).

I don't know what you mean by "built-in MyEclipse generation" (I'm an intermittent Eclipse user); but I was able to further modify the wsdl so that the XFire Plugin and the Web Services/Client wizard in the "Web Standard Tools" project (based on apache axis) both completed and generated code. Here's the re-modded wsdl:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2005 sp2 U (http://www.altova.com) by Rakesh Vidyadharan (Tribune Media Services) -->
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by John Wolak (Tribune Media Services) -->
<!-- $Id: xtvd.wsdl,v 1.22 2004/10/20 18:34:41 rakesh Exp $ -->
<!-- Edited with visual studio 09/10/2007 by Tom Shanley, for compatibility with Visual Studio -->
<!-- Edited with eclipse 09/18/2007 by Tom Shanley, for compatibility with eclipse web service client wizards -->
<wsdl:definitions xmlns:tms="urn:TMSWebServices"
   xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
   xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   targetNamespace="urn:TMSWebServices" name="xtvdWebService">
   <!-- removed this:
      xmlns="http://schemas.xmlsoap.org/wsdl/"
   -->
   <wsdl:types>
      <xsd:schema targetNamespace="urn:TMSWebServices">
         <xsd:include
            schemaLocation="http://docs.tms.tribune.com/tech/xml/schemas/tmsxtvd.xsd" />
         <xsd:complexType name="xtvdResponse">
            <xsd:sequence>
               <xsd:element name="messages">
                  <xsd:annotation>
                     <xsd:documentation xml:lang="en">
                        A collection of messages that may be
                        sent back by the server to the client.
                        Messages are usually used by the server
                        to notify the user of changes to their
                        subscription caused by automatic changes
                        in station's that are part of their
                        subscription. For instance, messages are
                        passed back if a lineup selected by the
                        user is no-longer valid, if all the
                        stations selected by the user has been
                        removed as they are no longer valid ...
                     </xsd:documentation>
                  </xsd:annotation>
                  <xsd:complexType>
                     <xsd:sequence>
                        <xsd:element name="message"
                           type="xsd:string" minOccurs="0" maxOccurs="unbounded">
                           <xsd:annotation>
                              <xsd:documentation
                                 xml:lang="en">
                                 An individual message that
                                 is passed back by the
                                 server.
                              </xsd:documentation>
                           </xsd:annotation>
                        </xsd:element>
                     </xsd:sequence>
                  </xsd:complexType>
               </xsd:element>
               <xsd:element ref="tms:xtvd" />
            </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="downloadTimes">
            <xsd:sequence>
               <xsd:element name="blockedDownloadTime"
                  type="tms:dateTime" minOccurs="0">
                  <xsd:annotation>
                     <xsd:documentation xml:lang="en">
                        The time (in UTC) until which download
                        requests will be blocked by the
                        webservice.
                     </xsd:documentation>
                  </xsd:annotation>
               </xsd:element>
               <xsd:element name="suggestedDownloadTime"
                  type="tms:dateTime">
                  <xsd:annotation>
                     <xsd:documentation xml:lang="en">
                        The time (in UTC) at which the
                        webservice recommends that the client
                        attempt another download request.
                     </xsd:documentation>
                  </xsd:annotation>
               </xsd:element>
            </xsd:sequence>
         </xsd:complexType>
      </xsd:schema>
   </wsdl:types>
   <wsdl:message name="downloadResponse">
      <wsdl:part name="xtvdResponse" type="tms:xtvdResponse" />
   </wsdl:message>
   <wsdl:message name="downloadRequest">
      <!--
         <wsdl:part name="startTime" type="tms:dateTime"/>
         <wsdl:part name="endTime" type="tms:dateTime"/>
      -->
      <wsdl:part name="startTime" type="xsd:string" />
      <wsdl:part name="endTime" type="xsd:string" />
   </wsdl:message>
   <wsdl:message name="acknowledgeResponse">
      <wsdl:part name="downloadTimes" type="tms:downloadTimes" />
   </wsdl:message>
   <wsdl:message name="voidMessage">
      <!-- wsdl:documentation xml:lang="en">A general success message to indicate a successful transaction.  In general failures will result in SOAP Faults.</wsdl:documentation -->
      <wsdl:documentation>
         A general success message to indicate a successful
         transaction. In general failures will result in SOAP Faults.
      </wsdl:documentation>
   </wsdl:message>
   <wsdl:message name="webserviceFault" >
      <!--
         tws added 09/18/07 for xfire wizard compat:
         NOTE THIS MAKES THIS VERSION OF THE WSDL ACTUALLY INCORRECT!
      -->
      <wsdl:part name="msg" type="xsd:string"></wsdl:part></wsdl:message>
   <wsdl:portType name="xtvdPortType">
      <wsdl:operation name="download">
         <wsdl:input message="tms:downloadRequest" />
         <wsdl:output message="tms:downloadResponse" />
         <wsdl:fault name="webserviceFault"
            message="tms:webserviceFault" />
      </wsdl:operation>
      <wsdl:operation name="acknowledge">
         <wsdl:input message="tms:voidMessage" />
         <wsdl:output message="tms:acknowledgeResponse" />
         <wsdl:fault name="FaultName" message="tms:webserviceFault" />
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="xtvdBinding" type="tms:xtvdPortType">
      <soap:binding style="rpc"
         transport="http://schemas.xmlsoap.org/soap/http" />
      <wsdl:operation name="download">
         <soap:operation
            soapAction="urn:TMSWebServices:xtvdWebService#download" style="rpc" />
         <wsdl:input>
            <!-- soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:TMSWebServices"/ -->
            <soap:body use="literal"
               encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
               namespace="urn:TMSWebServices" />
         </wsdl:input>
         <wsdl:output>
            <!-- soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:TMSWebServices"/ -->
            <soap:body use="literal"
               encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
               namespace="urn:TMSWebServices" />
         </wsdl:output>
         <wsdl:fault name="webserviceFault">
            <!-- soap:fault name="tms:webserviceFault" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:TMSWebServices"/ -->
            <soap:fault name="webserviceFault" use="literal"
               encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
         </wsdl:fault>
      </wsdl:operation>
      <wsdl:operation name="acknowledge">
         <soap:operation soapAction="urn:#acknowledge" style="rpc" />
         <wsdl:input>
            <soap:body use="literal" namespace="urn:TMSWebServices" />
         </wsdl:input>
         <wsdl:output>
            <soap:body use="literal" namespace="urn:TMSWebServices" />
         </wsdl:output>
         <wsdl:fault name="FaultName">
            <!-- tws added 9/18/07 for apache axis wizard compat  -->
            <soap:fault name="webserviceFault" use="literal"
               encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
         </wsdl:fault>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="xtvdWebService">
      <wsdl:port name="xtvdWebServicePort"
         binding="tms:xtvdBinding">
         <soap:address
            location="http://webservices.schedulesdirect.tmsdatadirect.com/schedulesdirect/tvlistings/xtvdService" />
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>


So much for the good news. The bad news: it apparently does not occur to either of these wizards that the client may need to authenticate. I suspect that there is some way to do it, but there is no well-exposed way to deal with it that I can find, and I've had no luck so far when digging deeper. For instance, in the axis code, one is supposed to be able to set the username and password properties on either of one of the axis client stub objects that are used inside the generated code; I edited the generated code to do either, or both, but still always got a 401 response. And the XFire library has apache http client stuff under it, that can accept a credential object, but it is buried so deep I was not able to reach it.

Anyway, here's a simple test client that worked with the XFire generated code and got as far as failing to authenticate. Maybe you know how to get it to work from there? And/or maybe the XML Beans flavor works differently?

Code: Select all
/******
 * test client to (fail to) access schedules direct web service
 * using the code generated by the XFire plugin for Eclipse
 * from the modified wsdl
 */

import tmswebservices.*;

public class xtvdClient1 {
   public static void main(String[] args)
   {
      xtvdWebServiceClient client = null;
      xtvdPortType port = null;
      XtvdResponse resp = null;
      try
      {
         client = new xtvdWebServiceClient();
         port = client.getxtvdWebServicePort();
         // right here I (and I would expect, anyone who is trying to
         // write a simple POJO client) want to create and set
         // the credential to be used in accessing the service.
         // as far as I can see, the developers of XFire omitted this
         // seemingly obvious, seemingly basic capability
         // their example for authentication shows how to add a handler
         // to add content to the message to be consumed by logic on the
         // server.  I just don't get how they think normal authentication
         // is supposed to work in their stack.
         resp = port.download("2007-09-20T13:00:00Z", "2007-09-20T14:00:00Z");
         for (String msg : resp.getMessages().getMessage())
         {
            System.out.println("Msg: " + msg);
         }
         System.out.println("Programs: " + resp.getXtvd().getSchedules().getSchedule().size());
      } catch (Throwable t)
      {
         System.err.println(t.toString());
      }
      finally
      {
         // I expect to have to release resources
         // but none of these classes have any method to do so.
      }

   }

}


I don't really get why the Java world would make such a basic thing so difficult and/or obscure, but IME it is often that way. Too many layers, maybe. Or it's so simple it "goes without saying" making it hard to find out how if you don't already know.

I do recall, from a few years back when I actually worked on Java Web Services, that a simple client is indeed really simple. I don't remember most of the details and have no access to any of the work I produced back then. But I think that generating XML Beans and then writing a simple Java client based directly on things like the SOAP libraries would be easier than unraveling what these wizards are doin. Too bad the Eclipse XML Beans plugin appears to be dead...

HTH,

-tom-
the_tom
 
Posts: 15
Joined: Mon Sep 10, 2007 4:19 pm

Re: Multiple Use error.

Postby Katharsys » Sat Sep 29, 2007 1:25 pm

Thanks for the assist Tom. The code does run through XFire, and gives me a bunch of wonderful classes (some better than others), however I have managed to head down a different track...

Tom Talbot has fixed his wonderful program (MyTelly), which has been my preferred guide for a while now, and has also posted the new source code. So, until z2l releases any of their tools, I am borrowing the pre-compiled jar: xtvdclient.jar (and others that the jar relies on).

This has cleared up the multiple use error entirely.

In response to your question, the SOAPRequest class contained in the xtvdclient.jar contains the authentication protocols:
Code: Select all
     SOAPRequest currentRequest = new SOAPRequest(userId,userPassword);
     currentRequest.setWebserviceURI(xmlDataSource);
    //and our xtvd resource
    Xtvd xtvd = new Xtvd();
    currentRequest.getData(startTime, stopTime, xtvd);


This generic snippet will then populate the Xtvd client object. If you wish to use something other than the Xtvd class, you are provided two additional options:

Code: Select all
     getDataFile(java.util.Calendar start, java.util.Calendar end, java.lang.String file) throws com.tms.webservices.applications.DataDirectException;
     getData(java.util.Calendar start, java.util.Calendar end, java.io.Writer writer) throws com.tms.webservices.applications.DataDirectException;


I can now connect without getting a 401, but my test unit is returning a da****d null pointer exception on the data return, and without the source, it is rather tricky trying to locate the problem. Getting the full envelope on return, but no data…
Katharsys
 
Posts: 2
Joined: Sat Sep 08, 2007 7:09 pm

Re: Multiple Use error.

Postby rshendershot » Sun Sep 30, 2007 2:33 am

AFAICT the MyTelly xtvdClient.jar is unchanged. The SOAPRequest is in com.tms.webservices.applications.xtvd and has a static field that sets URI to the old datadirect. MyTelly resets the URI so that the SD webservice is used. The ddclient.zip contains all this and is GPL-2. Perhaps Schedules Direct can offer that on this site?

To make the wsdl generate in Eclipse I followed edits made by The_Tom (thanks !!!) but dropped the soapfault and kept datetime and used TMSWebServices:xtvdWebService urn prefixes for the operations. Otherwise xfire generation still failed.

To get the authentication to work I imported org.codehaus.xfire.transport.Channel and set the user/pass into the xfire Client (built from the xtvdPortType service).
Code: Select all
        xtvdWebServiceClient client = new xtvdWebServiceClient();
        xtvdPortType service = client.getxtvdWebServicePort();

        Client c = Client.getInstance(service);
        c.setProperty(Channel.USERNAME, "myID");
        c.setProperty(Channel.PASSWORD, "myPass");


then I set up the start/end times and call service.download( start , end ).

HTH,
-Rick
rshendershot
 
Posts: 51
Joined: Fri Aug 17, 2007 6:19 am

Re: Multiple Use error.

Postby cfcubed » Wed Oct 10, 2007 6:20 am

rshendershot wrote:AFAICT the MyTelly xtvdClient.jar is unchanged.


Actually, I had to update xtvdClient.jar such that we can parse the new /New flag & can show firstrun series programs in bold (*very* minor change to one xtvdClient source file).
A TBD is to add our modified xtvdClient source to the My Telly sourceforge project .
cfcubed
 
Posts: 11
Joined: Wed Oct 10, 2007 6:00 am

Re: Multiple Use error.

Postby bodo » Sun Jan 20, 2008 12:49 pm

Where can I find the newest xtvdClient.jar? Can I use it in our GPL'ed Project tvbrowser.org ?

TVBrowser.org is an epg written in Java. The website is in german, but the application is fully translated into english and swedish. At the moment we are focusing to get into the international market. For that we want to add a schedulesdirect plugin to our system.

We once hat a zap2it plugin, but it was ugly and slow ... it has to be rewritten. The xtvcClient looks like a great starting point for this rewrite.
bodo
 
Posts: 21
Joined: Sun Jan 20, 2008 12:44 pm

Re: Multiple Use error.

Postby cfcubed » Mon Feb 11, 2008 7:48 am

Ha ha, didn't see it was you Bodo that posted the question re: xtvdclient.jar :)
See you started another thread here about http://sourceforge.net/projects/xtvdclient/ .
So maybe that line or two of code in AbstractParser.java marked w/CMF2007 is in some form in that project....

Good luck,
Chris
cfcubed
 
Posts: 11
Joined: Wed Oct 10, 2007 6:00 am

Re: Multiple Use error.

Postby bodo » Mon Feb 11, 2008 8:13 am

I started the project on sf and uploaded everything to sf. It is already refactored. I will release a 2.0-version till end of the week.

But i don't understand your Question

So maybe that line or two of code in AbstractParser.java marked w/CMF2007 is in some form in that project....


What do you mean by that?
bodo
 
Posts: 21
Joined: Sun Jan 20, 2008 12:44 pm


Return to Developers Corner

Who is online

Users browsing this forum: No registered users and 1 guest