Calling java webservice

Help
Markus
2010-06-10
2013-06-06
  • Markus

    Markus - 2010-06-10

    Hi!

    I am trying to make a simple call to simple webservice, but i can´t get it to work. The method i want to call takes no parameters and returns a string. The name of the function is hello2 and the code for calling it looks like this:

    $soapclient = new nusoap_client('http://localhost:8080/WebServiceTest/NewWebService?wsdl', 'wsdl'); 
    $result = $soapclient->call('hello2');
     print_r($result);
    

    and the wsdl looks like this:

    <definitions targetNamespace="http://ws.masu/" name="NewWebServiceService">
    
    <types>
    
    <xsd:schema>
    <xsd:import namespace="http://ws.masu/" schemaLocation="http://localhost:8080/WebServiceTest/NewWebService?xsd=1"/>
    </xsd:schema>
    </types>
    
    <message name="hello">
    <part name="parameters" element="tns:hello"/>
    </message>
    
    <message name="helloResponse">
    <part name="parameters" element="tns:helloResponse"/>
    </message>
    
    <message name="hello2">
    <part name="parameters" element="tns:hello2"/>
    </message>
    
    <message name="hello2Response">
    <part name="parameters" element="tns:hello2Response"/>
    </message>
    
    <portType name="NewWebService">
    
    <operation name="hello">
    <input wsam:Action="http://ws.masu/NewWebService/helloRequest" message="tns:hello"/>
    <output wsam:Action="http://ws.masu/NewWebService/helloResponse" message="tns:helloResponse"/>
    </operation>
    
    <operation name="hello2">
    <input wsam:Action="http://ws.masu/NewWebService/hello2Request" message="tns:hello2"/>
    <output wsam:Action="http://ws.masu/NewWebService/hello2Response" message="tns:hello2Response"/>
    </operation>
    </portType>
    
    <binding name="NewWebServicePortBinding" type="tns:NewWebService">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    
    <operation name="hello">
    <soap:operation soapAction=""/>
    
    <input>
    <soap:body use="literal"/>
    </input>
    
    <output>
    <soap:body use="literal"/>
    </output>
    </operation>
    
    <operation name="hello2">
    <soap:operation soapAction=""/>
    
    <input>
    <soap:body use="literal"/>
    </input>
    
    <output>
    <soap:body use="literal"/>
    </output>
    </operation>
    </binding>
    
    <service name="NewWebServiceService">
    
    <port name="NewWebServicePort" binding="tns:NewWebServicePortBinding">
    <soap:address location="http://localhost:8080/WebServiceTest/NewWebService"/>
    </port>
    </service>
    </definitions>
    

    I have made a test client in netbeans so i know that the webservice works, but i cant get it to work with nusoap. Is there anyone who can help me figure out what the problem is?

    / Markus

     
  • Scott Nichol

    Scott Nichol - 2010-06-18

    Technically, a document/literal operation always has exactly one parameter.  The type of the element representing the parameter is then used by tools and runtimes to determine the parameters a human would think the operation has.  NuSOAP's ability to do this may be failing you in this case.  I suggest you try to explicitly specify the parameter.

    $params = array();
    $result = $soapclient->call('hello2', array('parameters' => $params);

     
  • Markus

    Markus - 2010-06-21

    Hi!
    Thank you for your answer, that wasn't the problem though. The problem was with the mapping of localhost in the hosts file in windows. When i used 127.0.0.1 instead of localhost it worked.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks