[Newbie] J2ME Mobile Client for a NuSOAP ws

  • Leonardo Rodríguez

    i'm developing JavaME mobile client  for my web service created with
    NuSOAP. I'm trying to use Netbeans stubs to generate the client but the WSDL needs to be JSR 172 compatible, and the WSDL generated by NuSOAP is not.
    It is possible to configure NuSOAP to generate WSDL in format  JSR 172  ?
    If it is not, How can i develop the client? I'm doing some tests with an alternative approach  : kSOAP2. It works for a simple method with a xsd:string result but i don't know if it works with complex types . By the other hand,  i read that kSOAP2 stopped development in 2003. In summary, i'm interested in your recommendation about
    a mobile client development for a NuSOAP webservice.
    Thanks you in advance

  • Scott Nichol

    Scott Nichol - 2011-02-04

    > the WSDL needs to be JSR 172 compatible, and the WSDL generated by NuSOAP is not.

    You have a couple of options.

    1. A NuSOAP server can use a WSDL file rather than generating WSDL, so you can write the JSR 172 compatible WSDL and use it.

    2. What about the WSDL is not JSR 172 compatible?  If you post it here with your code and cite the problem(s), I may be able to change NuSOAP.

  • Leonardo Rodríguez

    For example, for this web server

    $server = new soap_server;
    $server->configureWSDL('hello', 'urn:hello');
    $server->register('hello', //method name
    array('name' => 'xsd:string'), // input parameters
    array('return' => 'xsd:string'), // output parameters
    'urn:hello', // namespace
    'urn:hello#hello', // soapaction
    'document', // style
    'literal', // use
    'Says hello to the caller' // documentation
    // Define functions
    function hello ($name){
    return "Hello $name";

    when i try to generate the mobile client in NetBeans 6.9 from the wsdl i get the error:
    'all' element in complex-type element is not supported by JSR 172
    i think the problem is in the WSDL segment:

    <xsd:complexType name="helloRequestType">
    <xsd:element name="name" type="xsd:string" form="unqualified"/>

    JSR 172 also require that style must be "document" and  use must be literal.

    Thank you in advance for help.

  • Scott Nichol

    Scott Nichol - 2011-02-05

    JSR 172 section 5.2.3 says

    "The JAX-RPC Subset specification supports the mapping of the following types of XML struct:  The xsd:complexType with sequences of simple type and complex types. Refer to the xsd:sequence"

    That is why it does not support xsd:all.  The line of NuSOAP code that uses xsd:all is

    $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements);

    Between JSR 172 and a re-reading of the relevant part of the XML Schema spec, I would say that 'sequence' is more appropriate than 'all'.  I will change that for now, but I am not sure that it will remain that way permanently.

    My note on your approach: NuSOAP is not tested for server document/literal support except when using a separate WSDL file.  What you are doing with NuSOAP is not forbidden, it is just not tested.

  • Scott Nichol

    Scott Nichol - 2011-02-06

    There are two lines of code like the one above, both in the addOperation method of the wsdl class.  The modification changes 'all' to 'sequence'.

    CVS is unavailable at this time, so I cannot commit the change.  However, I think you should be able to change these two lines yourself for now.


Log in to post a comment.