in reply to using a client SOAP with SOAP::Lite with ComplexType

As I asked when you posted this to SOAP-DISCUSS list, it looks like you have somehow managed to get the SOAP envelope to omit the Body part, if you could show us the client code that is causing the error then we probably can help you from there.

/J\

  • Comment on Re: using a client SOAP with SOAP::Lite with ComplexType

Replies are listed 'Best First'.
Re^2: using a client SOAP with SOAP::Lite with ComplexType
by jeanba (Novice) on May 11, 2006 at 15:10 UTC
    ok here is my client code :
    #!/usr/bin/perl use Data::Dumper; use SOAP::Lite; use SOAP::Data::ComplexType; use ContextType; my $soap = new SOAP::Lite uri => 'http://my_serv/services/DeliveryWS?wsdl', proxy => 'http://my_serv/services/DeliveryWS?wsdl' ; my $request_obj = ContextType_inner->new({Context=>{ user => 'jbbec', agent => 1 }}); $soap->soapversion(1.2); print $soap->changeDeliveryState(\SOAP::Data->value($request_obj->as_s +oap_data),526101,2)->faultstring; 1;
    thank you

      When I run your code I get an envelope which looks on balance to okay:

      <?xml version="1.0" encoding="UTF-8"?> <Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:namesp2="http://namespaces.soaplite.com/perl" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Body> <changeDeliveryState xmlns="http://my_serv/services/DeliveryWS?wsd +l"> <c-gensym3> <namesp1:Context xmlns:namesp1="http://my_serv/services/Delive +ryWS?wsdl" xsi:type="namesp2"> <agent xsi:type="xsd:int">1</agent> <user xsi:type="xsd:string">jbbec</user> </namesp1:Context> </c-gensym3> <c-gensym8 xsi:type="xsd:int">526101</c-gensym8> <c-gensym10 xsi:type="xsd:int">2</c-gensym10> </changeDeliveryState> </Body> </Envelope>
      Although the extra <c-gensym3 /> element seems to be erroneous and can be removed by changing the \SOAP::Data->value($request_obj->as_soap_data) to simply $request_obj->as_soap_data. The missing namespace prefix on the SOAP envelope would appear to be a bug in SOAP::Lite and can be fixed by omitting the setting of the soapversion().

      However I suspect that your actual error might be coming from elsewhere, could you post the output you get when you use:

      use SOAP::Lite +trace => 'all';
      So we can see what XML is actually being generated and returned.

      /J\

        Ok, thank you for your answer. I did what you said and the output was :
        SOAP::Serializer::envelope: () SOAP::Serializer::envelope: changeDeliveryState REF(0x862ab9c) 526101 +2 SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x846e +10c) SOAP::Transport::HTTP::Client::send_receive: POST http://my_serv/servi +ces/DeliveryWS?wsdl HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap Content-Length: 813 Content-Type: application/soap; charset=utf-8 SOAPAction: "http://my_serv/services/DeliveryWS?wsdl#changeDeliverySta +te" <?xml version="1.0" encoding="UTF-8"?><Envelope xmlns:xsi="http://www. +w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap +.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml +ns:namesp2="http://namespaces.soaplite.com/perl" soap:encodingStyle=" +http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas +.xmlsoap.org/soap/envelope/"><Body><changeDeliveryState xmlns="http:/ +/my_serv/services/DeliveryWS?wsdl"><c-gensym3><namesp1:Context xmlns: +namesp1="http://my_serv/services/DeliveryWS?wsdl" xsi:type="namesp2"> +<agent xsi:type="xsd:int">1</agent><user xsi:type="xsd:string">jbbec< +/user></namesp1:Context></c-gensym3><c-gensym8 xsi:type="xsd:int">526 +101</c-gensym8><c-gensym10 xsi:type="xsd:int">2</c-gensym10></changeD +eliveryState></Body></Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x874 +712c) SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Ser +ver Error Cache-Control: max-age=0 Connection: close Date: Fri, 12 May 2006 06:18:47 GMT Server: Apache/2.0.46 (Red Hat) mod_jk/1.2.8 mod_ssl/2.0.46 OpenSSL/0. +9.7a Content-Language: fr Content-Type: text/xml;charset=utf-8 Expires: Fri, 12 May 2006 06:18:47 GMT Client-Date: Fri, 12 May 2006 06:20:32 GMT Client-Peer: 10.10.1.4:80 Client-Response-Num: 1 Client-Transfer-Encoding: chunked <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envel +ope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http:// +www.w3.org/2001/XMLSchema-instance"><soapenv:Header><soapenv:Upgrade +soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mu +stUnderstand="0"><soapenv:SupportedEnvelope qname="soapenv:Envelope"/ +></soapenv:Upgrade></soapenv:Header><soapenv:Body><soapenv:Fault><fau +ltcode>soapenv:VersionMismatch</faultcode><faultstring>Version Mismat +ch</faultstring><detail><ns1:hostname xmlns:ns1="http://xml.apache.or +g/axis/">w1.agen.com</ns1:hostname></detail></soapenv:Fault></soapenv +:Body></soapenv:Envelope> SOAP::Deserializer::deserialize: () SOAP::Parser::decode: () SOAP::SOM::new: () SOAP::Lite::DESTROY: () SOAP::Deserializer::DESTROY: () SOAP::Parser::DESTROY: () SOAP::Transport::DESTROY: () SOAP::Serializer::DESTROY: () Version MismatchSOAP::SOM::DESTROY: ()
        I could see that the version of soap in my client was not 1.2, then commented the line in my client
        #$soap->soapversion(1.2);
        and i re-run the client and obtain this trace :
        SOAP::Transport::HTTP::Client::send_receive: POST http://my_serv/servi +ces/DeliveryWS?wsdl HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap Content-Length: 833 Content-Type: text/xml; charset=utf-8 SOAPAction: "http://my_serv/services/DeliveryWS?wsdl#changeDeliverySta +te" <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http:/ +/www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xm +lsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema +" xmlns:namesp2="http://namespaces.soaplite.com/perl" soap:encodingSt +yle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://sc +hemas.xmlsoap.org/soap/envelope/"><soap:Body><changeDeliveryState xml +ns="http://my_serv/services/DeliveryWS?wsdl"><c-gensym3><namesp1:Cont +ext xmlns:namesp1="http://my_serv/services/DeliveryWS?wsdl" xsi:type= +"namesp2"><agent xsi:type="xsd:int">1</agent><user xsi:type="xsd:stri +ng">jbbec</user></namesp1:Context></c-gensym3><c-gensym8 xsi:type="xs +d:int">526101</c-gensym8><c-gensym10 xsi:type="xsd:int">2</c-gensym10 +></changeDeliveryState></soap:Body></soap:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x874 +70b0) SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Ser +ver Error Cache-Control: max-age=0 Connection: close Date: Fri, 12 May 2006 07:50:31 GMT Server: Apache/2.0.46 (Red Hat) mod_jk/1.2.8 mod_ssl/2.0.46 OpenSSL/0. +9.7a Content-Language: fr Content-Type: text/xml;charset=utf-8 Expires: Fri, 12 May 2006 07:50:31 GMT Client-Date: Fri, 12 May 2006 07:52:15 GMT Client-Peer: 10.10.1.4:80 Client-Response-Num: 1 Client-Transfer-Encoding: chunked <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envel +ope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http:// +www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><fau +ltcode>soapenv:Server.userException</faultcode><faultstring>org.xml.s +ax.SAXException: Invalid element in com.delivery.middle.bean.fake.Con +text - Context</faultstring><detail><ns1:hostname xmlns:ns1="http://x +ml.apache.org/axis/">w1.agen.com</ns1:hostname></detail></soapenv:Fau +lt></soapenv:Body></soapenv:Envelope> SOAP::Deserializer::deserialize: () SOAP::Parser::decode: () SOAP::SOM::new: () SOAP::Lite::DESTROY: () SOAP::Deserializer::DESTROY: () SOAP::Parser::DESTROY: () SOAP::Transport::DESTROY: () SOAP::Serializer::DESTROY: () org.xml.sax.SAXException: Invalid element in com.delivery.middle.bean. +fake.Context - ContextSOAP::SOM::DESTROY: ()