Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

old dog learning ---wsdl problem  RSS feed

 
pat mariani
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, i'm an old timer trying to retrofit and existing service (was fixed field/binary) with a http/soap interface. looks easy enough until they (the middleware people) ask me for a wsdl, which i have devoted a many days of reading and some developing. I come up with:

http://pat.mariani.home.att.net/telni.wsdl

i'm using soaplite in perl and they use wsad 5.0 i get errors that the method i'm trying to define doesn't exist. the file is only 63 lines long! no complex types, nothing fancy, just ouch! wsad produces something about an unsupported extensible type in the output...i wasn't sent the exact error code.

any help would be much appreciated!

btw - it is a telephone number reverse look-up, not directly to public, but you could "use" it in the future.

pm
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that WSAD 5 would have trouble consuming your web service in its current form. Some points:

  • Interoperable SOAP web services only use POST. Forget that xmlns:http="http://schemas.xmlsoap.org/wsdl/http/ even exists.
  • Avoid SOAP section 5 encoding at all cost. Stick with literal.
  • You don't need xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" as it is your default namespace.
  • urn:getTelniBinding should be getTelniBinding (i.e. tns:getTelniBinding)


  • Unfortunately this would mean that you have to change your web services interface. I used Axis 1.3 WSDL2Java and fiddled around a bit:

    java org.apache.axis.wsdl.WSDL2Java -o src -p telni.ws telni.wsdl



    I believe that WSAD 5 should have no problem with this web services contract and it would lead to a Java interface of something like this:

    (except that WSAD would insert its own version of org.apache.axis.holders.DateHolder)

    Have a look at Creating Web Services with Apache Axis. The information therein should allow you to create your own Java-based web client that you can use to test your web service with.


    Of course Java developers would prefer an interface like this:



    For that, something like the following is needed:


    [ October 30, 2007: Message edited by: Peer Reynders ]
     
    pat mariani
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Well i just cann't thank you enough for the redirect - it was looking so simple that http://telni../..cgi?RequestedTN=1231231231 would produce a nice little soap response, that i just couldn't get by it. that is going to turn my 5 lines script into 7 ot 8 lines......

    cheers
    pat
     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    WSDL:



    Resulting Java interface:



    HTTP/SOAP Request:



    HTTP/SOAP Response:


    In addition you may want to think about moving responseCode and responseMessage into a SOAP fault.
     
    pat mariani
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    nicely done - i was wondering how to use the definition of the request in the response. couple of questions - i'm assuming the 'sequence' tag forces order to the parameters (vs 'all')

    also, the generated code has the tag 'request' rather than the full name of the message - is that just a revision after generation.

    looks alot simpler than the book! now if i can get the server side code to work in perl/soaplite i'll be good to go.

    as an aside, your suggestion to move the responseCode/msg to a fault was my thinking, but the middleware people only want me to throw a fault if there is a soap encoding/decoding problem, not something like an unexepected value, or a failed database search.

    Oh, there are two computers providing this service - production00 and production01 (eliminating a single point of failure other than my software!) - can i have two port entries inside the service section with the same name? different names? two service sections?

    much thanks again.
     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by pat mariani:
    it was looking so simple that http://telni../..cgi?RequestedTN=1231231231 would produce a nice little soap response


    Well, the RESTful web services camp agrees with you that whole the SOAP thing is overkill for applications like this. However they also like less arcane URIs and they want to get rid of the prevalent RPC mindset. While SOAP is transport agnostic (ignorant), REST embraces all the features of the HTTP protocol. Basically a URI identifies a resource, which also allows you to access the representation (which can be XML but doesn't have to be) of the resource�s state and the HTTP verbs are the operations that allow you to manipulate the state of the resource.

    Of course, your WSAD guys wouldn't be too keen on this because they don't have a wizard in their IDE that could consume such a web service - that would require hand-coding. So instead they make you do the heavy lifting by requiring a WSDL for your simple interface so that they only have minimal manual coding and just have press the wizard's "GO" button.

    However the Web Application Description Language (WADL) that can describe RESTful web services is in the works.
    If you are interested, have a look at WS* vs. REST / Intelligence vs. Wisdom.


    i'm assuming the 'sequence' tag forces order to the parameters (vs 'all')

    Correct. "sequence" defines the order of the elements. In "all" they may appear in any order - however it may not contain other "all" or "sequence" groups, only single elements may be used in an "all" group, and each child may only occur once or not at all.


    the generated code has the tag 'request' rather than the full name of the message.

    The "request" element in the SOAP request originates for the name that was assigned to the "tnToNameAndTypeRequestMessage" message part.
    As a matter of fact you can lose the entire wrapping "getNameAndType" element in the SOAP body if you change from rpc/literal to document/literal. document/literal messaging only allows a single part ("the document") in the wsdl:message - so the wsdl:operation name becomes superfluous. The web service classifies (and processes) the request based on the "document name (type)", not based on any operation name.


    Oh, there are two computers providing this service - production00 and production01 (eliminating a single point of failure other than my software!) - can i have two port entries inside the service section with the same name?

    Multiple port entries (with the respective bindings) inside the same service definition are considered alternates - so the client has to choose one over the others. There is no consideration for failover as that is the responsibility of the failover cluster in your hardware infrastructure.
     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    WSDL (document/literal version):


    Resulting Java interface:



    HTTP/SOAP Request. Note the lack of the getNameAndType element present in the RPC version:



    HTTP/SOAP Response. Again no getNameAndType element:
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!