Loading ...
Sorry, an error occurred while loading the content.

call soap services with SOAP::LITE ? problem with complexType

Expand Messages
  • miage_2003
    I try to use a webServices with SOAP::LITE. With only simpleType like String is OK. But if I work with complexType my object in the service is always NULL. I m
    Message 1 of 3 , Mar 24, 2010
    • 0 Attachment

      I try to use a webServices with SOAP::LITE. With only simpleType like String is OK. But if I work with complexType my object in the service is always NULL.

      I'm new in perl development and I need help please.

      How call my type that name is "PARAMETERS" ?

      Thanks for your help.

      -------------- My SOAP:LITE client --------- (problem)

      #!perl

      use strict;

      use SOAP::Lite;

      my $client = SOAP::Lite
       ->proxy('http://172.31.179.213:8080/PrototypeCXF_2/UsService?wsdl');

      my $result = $client->callOperation3(SOAP::Data->name('USER' => \SOAP::Data->value(
                  SOAP::Data->name('USER' => 'user')
                  ,SOAP::Data->name('PASSWORD' => 'password')
                  ))
               ,SOAP::Data->name('EQUIPMENTPARAMSREQUEST' => \SOAP::Data->value(
                  SOAP::Data->name('TYPE' => 'type')
                  ,SOAP::Data->name('NAME' => 'name')
                  ,SOAP::Data->name('ADDRESS' => 'address')
                  ,SOAP::Data->name('VENDOR_MODEL' => 'vendor_model')
                  ,SOAP::Data->name('PARALLEL_EXEC' => 'parallel_exec')
                  ,SOAP::Data->name('PARAMETERS' => [{'key' => 'clef', 'value' => 'valeur'}])->type('complexType')
                  ,SOAP::Data->name('OPERATIONAL_STATE' => 'operational_state')
                  ))   
               );          

      unless ($result->fault) {

       print $result->result();

      } else {

       print join ', ',
        $result->faultcode,
        $result->faultstring,
        $result->faultdetail;
      }

      ------------- My WSDL ---------(problem)

        <?xml version="1.0" ?>
      - <wsdl:definitions name="ContactUsServiceImplService" targetNamespace="http://prototypeCXF.test.foo.com/" xmlns:ns1="http://cxf.apache.org/bindings/xformat" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://prototypeCXF.test.foo.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      - <wsdl:types>
      - <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://prototypeCXF.test.foo.com/" xmlns:tns="http://prototypeCXF.test.foo.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      - <xs:complexType name="userRequest">
      - <xs:sequence>
        <xs:element minOccurs="0" name="PASSWORD" type="xs:string" />
        <xs:element minOccurs="0" name="USER" type="xs:string" />
        </xs:sequence>
        </xs:complexType>
      - <xs:complexType name="equipmentParamsRequest">
      - <xs:sequence>
        <xs:element minOccurs="0" name="ADDRESS" type="xs:string" />
        <xs:element minOccurs="0" name="NAME" type="xs:string" />
        <xs:element minOccurs="0" name="OPERATIONAL_STATE" type="xs:int" />
        <xs:element minOccurs="0" name="PARALLEL_EXEC" type="xs:int" />
      - <xs:element name="PARAMETERS">
      - <xs:complexType>
      - <xs:sequence>
      - <xs:element maxOccurs="unbounded" minOccurs="0" name="entry">
      - <xs:complexType>
      - <xs:sequence>
        <xs:element minOccurs="0" name="key" type="xs:anyType" />
        <xs:element minOccurs="0" name="value" type="xs:anyType" />
        </xs:sequence>
        </xs:complexType>
        </xs:element>
        </xs:sequence>
        </xs:complexType>
        </xs:element>
        <xs:element minOccurs="0" name="TYPE" type="xs:string" />
        <xs:element minOccurs="0" name="VENDOR_MODEL" type="xs:string" />
        </xs:sequence>
        </xs:complexType>
      - <xs:complexType name="hashMap">
      - <xs:complexContent>
      - <xs:extension base="tns:abstractMap">
        <xs:sequence />
        </xs:extension>
        </xs:complexContent>
        </xs:complexType>
      - <xs:complexType abstract="true" name="abstractMap">
        <xs:sequence />
        </xs:complexType>
        <xs:element name="callOperation3" type="tns:callOperation3" />
      - <xs:complexType name="callOperation3">
      - <xs:sequence>
        <xs:element minOccurs="0" name="USER" type="tns:userRequest" />
        <xs:element minOccurs="0" name="EQUIPMENTPARAMS" type="tns:equipmentParamsRequest" />
        </xs:sequence>
        </xs:complexType>
        <xs:element name="callOperation3Response" type="tns:callOperation3Response" />
      - <xs:complexType name="callOperation3Response">
        <xs:sequence />
        </xs:complexType>
        </xs:schema>
        </wsdl:types>
      - <wsdl:message name="callOperation3Response">
        <wsdl:part element="tns:callOperation3Response" name="parameters" />
        </wsdl:message>
      - <wsdl:message name="callOperation3">
        <wsdl:part element="tns:callOperation3" name="parameters" />
        </wsdl:message>
      - <wsdl:portType name="ContactUsService">
      - <wsdl:operation name="callOperation3">
        <wsdl:input message="tns:callOperation3" name="callOperation3" />
        <wsdl:output message="tns:callOperation3Response" name="callOperation3Response" />
        </wsdl:operation>
        </wsdl:portType>
      - <wsdl:binding name="ContactUsServiceImplServiceSoapBinding" type="tns:ContactUsService">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
      - <wsdl:operation name="callOperation3">
        <soap:operation soapAction="" style="document" />
      - <wsdl:input name="callOperation3">
        <soap:body use="literal" />
        </wsdl:input>
      - <wsdl:output name="callOperation3Response">
        <soap:body use="literal" />
        </wsdl:output>
        </wsdl:operation>
        </wsdl:binding>
      - <wsdl:service name="ContactUsServiceImplService">
      - <wsdl:port binding="tns:ContactUsServiceImplServiceSoapBinding" name="ContactUsServiceImplPort">
        <soap:address location="http://localhost:8080/PrototypeCXF_2/UsService" />
        </wsdl:port>
        </wsdl:service>
        </wsdl:definitions>
    • Jo Rhett
      Does the object being returned know how to represent itself to print? I suspect not. ... use Data::Dumper; print Data::Dumper- Dump( $result- result() );
      Message 2 of 3 , Mar 25, 2010
      • 0 Attachment
        Does the object being returned know how to represent itself to print?   I suspect not.

        I would try doing this and looking at the result, then figuring out what commands to output it:

         print $result->result();

        use Data::Dumper;
        print Data::Dumper->Dump( $result->result() );

        This will show you the object types being returned.  Then write a routine to output the appropriate form.

        On Mar 24, 2010, at 1:58 AM, miage_2003 wrote:

        I try to use a webServices with SOAP::LITE. With only simpleType like String is OK. But if I work with complexType my object in the service is always NULL.

        I'm new in perl development and I need help please.

        How call my type that name is "PARAMETERS" ?

        Thanks for your help.

        ------------ -- My SOAP:LITE client --------- (problem)

        #!perl

        use strict;

        use SOAP::Lite;

        my $client = SOAP::Lite
         ->proxy('http: //172.31. 179.213:8080/ PrototypeCXF_ 2/UsService? wsdl');

        my $result = $client->callOperation3( SOAP::Data->name('USER' => \SOAP::Data->value(
                    SOAP::Data->name('USER' => 'user')
                    ,SOAP::Data->name('PASSWORD' => 'password')
                    ))
                 ,SOAP::Data->name('EQUIPMENTPARA MSREQUEST' => \SOAP::Data->value(
                    SOAP::Data->name('TYPE' => 'type')
                    ,SOAP::Data->name('NAME' => 'name')
                    ,SOAP::Data->name('ADDRESS' => 'address')
                    ,SOAP::Data->name('VENDOR_ MODEL' => 'vendor_model' )
                    ,SOAP::Data->name('PARALLEL_ EXEC' => 'parallel_exec' )
                    ,SOAP::Data->name('PARAMETERS' => [{'key' => 'clef', 'value' => 'valeur'}])->type('complexType' )
                    ,SOAP::Data->name('OPERATIONAL_ STATE' => 'operational_ state')
                    ))   
                 );          

        unless ($result->fault) {

         print $result->result();

        } else {

         print join ', ',
          $result->faultcode,
          $result->faultstring,
          $result->faultdetail;
        }

        ------------ - My WSDL ---------(problem)

          <?xml version="1.0" ?>
        - <wsdl:definitions name="ContactUsServ iceImplService" targetNamespace= "http://prototypeCXF .test.foo. com/" xmlns:ns1="http://cxf.apache. org/bindings/ xformat" xmlns:soap="http://schemas. xmlsoap.org/ wsdl/soap/" xmlns:tns="http://prototypeCXF .test.foo. com/" xmlns:wsdl="http://schemas. xmlsoap.org/ wsdl/" xmlns:xsd="http://www.w3. org/2001/ XMLSchema">
        - <wsdl:types>
        - <xs:schema attributeFormDefaul t="unqualified" elementFormDefault= "unqualified" targetNamespace= "http://prototypeCXF .test.foo. com/" xmlns:tns="http://prototypeCXF .test.foo. com/" xmlns:xs="http://www.w3. org/2001/ XMLSchema">
        - <xs:complexType name="userRequest">
        - <xs:sequence>
          <xs:element minOccurs="0" name="PASSWORD" type="xs:string" />
          <xs:element minOccurs="0" name="USER" type="xs:string" />
          </xs:sequence>
          </xs:complexType>
        - <xs:complexType name="equipmentPara msRequest">
        - <xs:sequence>
          <xs:element minOccurs="0" name="ADDRESS" type="xs:string" />
          <xs:element minOccurs="0" name="NAME" type="xs:string" />
          <xs:element minOccurs="0" name="OPERATIONAL_ STATE" type="xs:int" />
          <xs:element minOccurs="0" name="PARALLEL_ EXEC" type="xs:int" />
        - <xs:element name="PARAMETERS">
        - <xs:complexType>
        - <xs:sequence>
        - <xs:element maxOccurs="unbounde d" minOccurs="0" name="entry">
        - <xs:complexType>
        - <xs:sequence>
          <xs:element minOccurs="0" name="key" type="xs:anyType" />
          <xs:element minOccurs="0" name="value" type="xs:anyType" />
          </xs:sequence>
          </xs:complexType>
          </xs:element>
          </xs:sequence>
          </xs:complexType>
          </xs:element>
          <xs:element minOccurs="0" name="TYPE" type="xs:string" />
          <xs:element minOccurs="0" name="VENDOR_ MODEL" type="xs:string" />
          </xs:sequence>
          </xs:complexType>
        - <xs:complexType name="hashMap">
        - <xs:complexContent>
        - <xs:extension base="tns:abstractM ap">
          <xs:sequence />
          </xs:extension>
          </xs:complexContent>
          </xs:complexType>
        - <xs:complexType abstract="true" name="abstractMap">
          <xs:sequence />
          </xs:complexType>
          <xs:element name="callOperation 3" type="tns:callOpera tion3" />
        - <xs:complexType name="callOperation 3">
        - <xs:sequence>
          <xs:element minOccurs="0" name="USER" type="tns:userReque st" />
          <xs:element minOccurs="0" name="EQUIPMENTPARA MS" type="tns:equipment ParamsRequest" />
          </xs:sequence>
          </xs:complexType>
          <xs:element name="callOperation 3Response" type="tns:callOpera tion3Response" />
        - <xs:complexType name="callOperation 3Response">
          <xs:sequence />
          </xs:complexType>
          </xs:schema>
          </wsdl:types>
        - <wsdl:message name="callOperation 3Response">
          <wsdl:part element="tns: callOperation3Re sponse" name="parameters" />
          </wsdl:message>
        - <wsdl:message name="callOperation 3">
          <wsdl:part element="tns: callOperation3" name="parameters" />
          </wsdl:message>
        - <wsdl:portType name="ContactUsServ ice">
        - <wsdl:operation name="callOperation 3">
          <wsdl:input message="tns: callOperation3" name="callOperation 3" />
          <wsdl:output message="tns: callOperation3Re sponse" name="callOperation 3Response" />
          </wsdl:operation>
          </wsdl:portType>
        - <wsdl:binding name="ContactUsServ iceImplServiceSo apBinding" type="tns:ContactUs Service">
          <soap:binding style="document" transport="http://schemas. xmlsoap.org/ soap/http" />
        - <wsdl:operation name="callOperation 3">
          <soap:operation soapAction=" " style="document" />
        - <wsdl:input name="callOperation 3">
          <soap:body use="literal" />
          </wsdl:input>
        - <wsdl:output name="callOperation 3Response">
          <soap:body use="literal" />
          </wsdl:output>
          </wsdl:operation>
          </wsdl:binding>
        - <wsdl:service name="ContactUsServ iceImplService">
        - <wsdl:port binding="tns: ContactUsService ImplServiceSoapB inding" name="ContactUsServ iceImplPort">
          <soap:address location="http://localhost: 8080/PrototypeCX F_2/UsService" />
          </wsdl:port>
          </wsdl:service>
          </wsdl:definitions>


        -- 
        Jo Rhett
        Net Consonance : consonant endings by net philanthropy, open source and other randomness

      • Martin Busik
        Hi, ... You mean the request does not contain your parameter? Try: $client- call( callOperation3 ,SOAP::Data- name( USER ... Cheers, Martin
        Message 3 of 3 , Mar 27, 2010
        • 0 Attachment
          Hi,

          > I try to use a webServices with SOAP::LITE. With only
          > simpleType like String is OK. But if I work with complexType
          > my object in the service is always NULL.

          You mean the request does not contain your parameter?

          Try:

          $client->call('callOperation3',SOAP::Data->name('USER' ...

          Cheers,
          Martin
        Your message has been successfully submitted and would be delivered to recipients shortly.