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

complexType problems?

Expand Messages
  • nbartusi
    I think my problem is in trying to send complexType data to a SOAP method. The SOAP service is on a Oracle 10g server written in Java, and I do not have
    Message 1 of 3 , Dec 28, 2005
    • 0 Attachment
      I think my problem is in trying to send 'complexType' data to a SOAP
      method. The SOAP service is on a Oracle 10g server written in Java,
      and I do not have access to the source code. The definition I was
      given for this method is:

      <xsd:element name="AddLearners" nillable="false">
      <xsd:complexType>
      <xsd:sequence>
      <xsd:element ref="tns:Caller">
      <xsd:complexType>
      <xsd:sequence>
      <xsd:element name="CallerID"
      type="xsd:string"/>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
      <xsd:element maxOccurs="unbounded" ref="tns:Learner">
      <xsd:complexType>
      <xsd:sequence>
      <xsd:element name="StudentID" type="xsd:string"
      nillable="true"/>
      <xsd:element name="LastName" type="xsd:string"
      nillable="true"/>
      <xsd:element name="FirstName" type="xsd:string"
      nillable="true"/>
      <xsd:element name="MiddleInitial"
      type="xsd:string" nillable="true"/>
      <xsd:element name="NotActive"
      type="xsd:boolean" default="false" nillable="true"/>
      ...
      <xsd:element ref="tns:StudentPhones">
      <xsd:complexType>
      <xsd:sequence>
      <xsd:element name="StudentPhone"
      maxOccurs="unbounded" nillable="true">
      <xsd:complexType>
      <xsd:sequence>
      <xsd:element
      name="PhoneNumber" type="xsd:string"/>
      <xsd:element
      name="PhoneDescription" type="xsd:string"/>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>


      My code is:


      use SOAP::Lite;

      open(OUT,'>soap03.txt');

      $service = SOAP::Lite
      -> uri('http://axis.webservices.elms.plateausystems.com')
      -> proxy
      ('http://USER:PW@SERVER/elms/services/PlateauLMSService')
      -> on_debug(sub{print OUT @_})
      ;

      $callerid = SOAP::Data->name('CallerID' => 'USER');
      $caller = SOAP::Data->name('Caller' => [$callerid]);

      my $learner_insert = SOAP::Data->name('Learners' => [
      SOAP::Data->name('StudentID' => '111111112') ->type
      ('string'),
      SOAP::Data->name('LastName' => ''),
      SOAP::Data->name('FirstName' => ''),
      SOAP::Data->name('MiddleInitial' => ''),
      SOAP::Data->name('NotActive' => '1') ->type
      ('boolean'),
      ...
      SOAP::Data->name('StudentPhones'=> [
      SOAP::Data->name('StudentPhone'=>
      SOAP::Data->name('PhoneNumber'
      => ''),
      SOAP::Data->name
      ('PhoneDescription'=> ''))])]);

      $result = $service -> addLearners($caller,$learner_insert);


      The XML generated is:

      POST http://USER:PW@SERVER/elms/services/PlateauLMSService
      Content-Length: 3384
      Content-Type: text/xml
      SOAPAction: "http://axis.webservices.elms.plateausystems.com#addLearn
      ers"

      <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-
      ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-
      ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-
      ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"><SOAP-ENV:Body>

      <namesp1:addLearners
      xmlns:namesp1="http://axis.webservices.elms.plateausystems.com">
      <Caller SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-
      ENC:Array">
      <CallerID xsi:type="xsd:string">USER</CallerID>
      </Caller>
      <Learners SOAP-ENC:arrayType="xsd:ur-type[58]" xsi:type="SOAP-
      ENC:Array">
      <StudentID xsi:type="xsd:string">111111112</StudentID>
      <LastName xsi:type="xsd:string"/>
      <FirstName xsi:type="xsd:string"/>
      <MiddleInitial xsi:type="xsd:string"/>
      <NotActive xsi:type="xsd:boolean">true</NotActive>
      ...
      <StudentPhones SOAP-ENC:arrayType="xsd:string[2]" xsi:type="SOAP-
      ENC:Array">
      <PhoneNumber xsi:type="xsd:string"/>
      <PhoneDescription xsi:type="xsd:string"/>
      </StudentPhones>
      </Learners>
      </namesp1:addLearners>

      </SOAP-ENV:Body></SOAP-ENV:Envelope>


      The error returned by the SOAP service is:

      <soapenv:Envelope
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
      <soapenv:Fault>
      <faultcode>soapenv:Server.userException</faultcode>
      <faultstring>org.xml.sax.SAXException: Invalid element in
      com.plateausystems.elms.webservices.axis.AddLearners -
      Caller</faultstring>
      <detail>
      <ns1:hostname
      xmlns:ns1="http://xml.apache.org/axis/">SERVER</ns1:hostname>
      </detail>
      </soapenv:Fault>
      </soapenv:Body>
      </soapenv:Envelope>


      Any ideas? Is there an error in my XML?

      Thanks,
      Nathaniel Bartusiak
    • Byrne Reese
      Please consult http://www.majordojo.com/soaplite/ for the articles about composing messages with complex types...
      Message 2 of 3 , Dec 29, 2005
      • 0 Attachment
        Please consult http://www.majordojo.com/soaplite/ for the articles about
        composing messages with complex types...

        nbartusi wrote:
        > I think my problem is in trying to send 'complexType' data to a SOAP
        > method. The SOAP service is on a Oracle 10g server written in Java,
        > and I do not have access to the source code. The definition I was
        > given for this method is:
        >
        > <xsd:element name="AddLearners" nillable="false">
        > <xsd:complexType>
        > <xsd:sequence>
        > <xsd:element ref="tns:Caller">
        > <xsd:complexType>
        > <xsd:sequence>
        > <xsd:element name="CallerID"
        > type="xsd:string"/>
        > </xsd:sequence>
        > </xsd:complexType>
        > </xsd:element>
        > <xsd:element maxOccurs="unbounded" ref="tns:Learner">
        > <xsd:complexType>
        > <xsd:sequence>
        > <xsd:element name="StudentID" type="xsd:string"
        > nillable="true"/>
        > <xsd:element name="LastName" type="xsd:string"
        > nillable="true"/>
        > <xsd:element name="FirstName" type="xsd:string"
        > nillable="true"/>
        > <xsd:element name="MiddleInitial"
        > type="xsd:string" nillable="true"/>
        > <xsd:element name="NotActive"
        > type="xsd:boolean" default="false" nillable="true"/>
        > ...
        > <xsd:element ref="tns:StudentPhones">
        > <xsd:complexType>
        > <xsd:sequence>
        > <xsd:element name="StudentPhone"
        > maxOccurs="unbounded" nillable="true">
        > <xsd:complexType>
        > <xsd:sequence>
        > <xsd:element
        > name="PhoneNumber" type="xsd:string"/>
        > <xsd:element
        > name="PhoneDescription" type="xsd:string"/>
        > </xsd:sequence>
        > </xsd:complexType>
        > </xsd:element>
        > </xsd:sequence>
        > </xsd:complexType>
        > </xsd:element>
        > </xsd:sequence>
        > </xsd:complexType>
        > </xsd:element>
        > </xsd:sequence>
        > </xsd:complexType>
        > </xsd:element>
        >
        >
        > My code is:
        >
        >
        > use SOAP::Lite;
        >
        > open(OUT,'>soap03.txt');
        >
        > $service = SOAP::Lite
        > -> uri('http://axis.webservices.elms.plateausystems.com')
        > <http://axis.webservices.elms.plateausystems.com%27%29>
        > -> proxy
        > ('http://USER:PW@SERVER/elms/services/PlateauLMSService')
        > <http://USER:PW@SERVER/elms/services/PlateauLMSService%27%29>
        > -> on_debug(sub{print OUT @_})
        > ;
        >
        > $callerid = SOAP::Data->name('CallerID' => 'USER');
        > $caller = SOAP::Data->name('Caller' => [$callerid]);
        >
        > my $learner_insert = SOAP::Data->name('Learners' => [
        > SOAP::Data->name('StudentID' => '111111112') ->type
        > ('string'),
        > SOAP::Data->name('LastName' => ''),
        > SOAP::Data->name('FirstName' => ''),
        > SOAP::Data->name('MiddleInitial' => ''),
        > SOAP::Data->name('NotActive' => '1') ->type
        > ('boolean'),
        > ...
        > SOAP::Data->name('StudentPhones'=> [
        > SOAP::Data->name('StudentPhone'=>
        > SOAP::Data->name('PhoneNumber'
        > => ''),
        > SOAP::Data->name
        > ('PhoneDescription'=> ''))])]);
        >
        > $result = $service -> addLearners($caller,$learner_insert);
        >
        >
        > The XML generated is:
        >
        > POST http://USER:PW@SERVER/elms/services/PlateauLMSService
        > Content-Length: 3384
        > Content-Type: text/xml
        > SOAPAction: "http://axis.webservices.elms.plateausystems.com#addLearn
        > ers"
        >
        > <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-
        > ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-
        > ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-
        > ENV="http://schemas.xmlsoap.org/soap/envelope/"
        > xmlns:xsd="http://www.w3.org/1999/XMLSchema"><SOAP-ENV:Body>
        >
        > <namesp1:addLearners
        > xmlns:namesp1="http://axis.webservices.elms.plateausystems.com">
        > <Caller SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-
        > ENC:Array">
        > <CallerID xsi:type="xsd:string">USER</CallerID>
        > </Caller>
        > <Learners SOAP-ENC:arrayType="xsd:ur-type[58]" xsi:type="SOAP-
        > ENC:Array">
        > <StudentID xsi:type="xsd:string">111111112</StudentID>
        > <LastName xsi:type="xsd:string"/>
        > <FirstName xsi:type="xsd:string"/>
        > <MiddleInitial xsi:type="xsd:string"/>
        > <NotActive xsi:type="xsd:boolean">true</NotActive>
        > ...
        > <StudentPhones SOAP-ENC:arrayType="xsd:string[2]" xsi:type="SOAP-
        > ENC:Array">
        > <PhoneNumber xsi:type="xsd:string"/>
        > <PhoneDescription xsi:type="xsd:string"/>
        > </StudentPhones>
        > </Learners>
        > </namesp1:addLearners>
        >
        > </SOAP-ENV:Body></SOAP-ENV:Envelope>
        >
        >
        > The error returned by the SOAP service is:
        >
        > <soapenv:Envelope
        > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        > <soapenv:Body>
        > <soapenv:Fault>
        > <faultcode>soapenv:Server.userException</faultcode>
        > <faultstring>org.xml.sax.SAXException: Invalid element in
        > com.plateausystems.elms.webservices.axis.AddLearners -
        > Caller</faultstring>
        > <detail>
        > <ns1:hostname
        > xmlns:ns1="http://xml.apache.org/axis/">SERVER</ns1:hostname>
        > </detail>
        > </soapenv:Fault>
        > </soapenv:Body>
        > </soapenv:Envelope>
        >
        >
        > Any ideas? Is there an error in my XML?
        >
        > Thanks,
        > Nathaniel Bartusiak
      • nbartusi
        Thanks for the link. The code did help get a similar section working. Unfortunately I am still getting the same error with this service, Invalid element in
        Message 3 of 3 , Dec 30, 2005
        • 0 Attachment
          Thanks for the link. The code did help get a similar section
          working. Unfortunately I am still getting the same error with this
          service, 'Invalid element in
          com.plateausystems.elms.webservices.axis.AddLearners - Caller'.
          Since similar calls to other services work I am now thinking the
          problem is with the service.

          Thanks,
          Nathaniel Bartusiak


          --- In soaplite@yahoogroups.com, Byrne Reese <byrne@m...> wrote:
          >
          > Please consult http://www.majordojo.com/soaplite/ for the articles
          about
          > composing messages with complex types...
          >
          > nbartusi wrote:
          > > I think my problem is in trying to send 'complexType' data to a
          SOAP
          > > method. The SOAP service is on a Oracle 10g server written in
          Java,
          > > and I do not have access to the source code. The definition I
          was
          > > given for this method is:
          > >
          > > <xsd:element name="AddLearners" nillable="false">
          > > <xsd:complexType>
          > > <xsd:sequence>
          > > <xsd:element ref="tns:Caller">
          > > <xsd:complexType>
          > > <xsd:sequence>
          > > <xsd:element name="CallerID"
          > > type="xsd:string"/>
          > > </xsd:sequence>
          > > </xsd:complexType>
          > > </xsd:element>
          > > <xsd:element maxOccurs="unbounded" ref="tns:Learner">
          > > <xsd:complexType>
          > > <xsd:sequence>
          > > <xsd:element name="StudentID"
          type="xsd:string"
          > > nillable="true"/>
          > > <xsd:element name="LastName"
          type="xsd:string"
          > > nillable="true"/>
          > > <xsd:element name="FirstName"
          type="xsd:string"
          > > nillable="true"/>
          > > <xsd:element name="MiddleInitial"
          > > type="xsd:string" nillable="true"/>
          > > <xsd:element name="NotActive"
          > > type="xsd:boolean" default="false" nillable="true"/>
          > > ...
          > > <xsd:element ref="tns:StudentPhones">
          > > <xsd:complexType>
          > > <xsd:sequence>
          > > <xsd:element name="StudentPhone"
          > > maxOccurs="unbounded" nillable="true">
          > > <xsd:complexType>
          > > <xsd:sequence>
          > > <xsd:element
          > > name="PhoneNumber" type="xsd:string"/>
          > > <xsd:element
          > > name="PhoneDescription" type="xsd:string"/>
          > > </xsd:sequence>
          > > </xsd:complexType>
          > > </xsd:element>
          > > </xsd:sequence>
          > > </xsd:complexType>
          > > </xsd:element>
          > > </xsd:sequence>
          > > </xsd:complexType>
          > > </xsd:element>
          > > </xsd:sequence>
          > > </xsd:complexType>
          > > </xsd:element>
          > >
          > >
          > > My code is:
          > >
          > >
          > > use SOAP::Lite;
          > >
          > > open(OUT,'>soap03.txt');
          > >
          > > $service = SOAP::Lite
          > > -> uri
          ('http://axis.webservices.elms.plateausystems.com')
          > > <http://axis.webservices.elms.plateausystems.com%27%29>
          > > -> proxy
          > > ('http://USER:PW@SERVER/elms/services/PlateauLMSService')
          > > <http://USER:PW@SERVER/elms/services/PlateauLMSService%27%29>
          > > -> on_debug(sub{print OUT @_})
          > > ;
          > >
          > > $callerid = SOAP::Data->name('CallerID' => 'USER');
          > > $caller = SOAP::Data->name('Caller' => [$callerid]);
          > >
          > > my $learner_insert = SOAP::Data->name('Learners' => [
          > > SOAP::Data->name('StudentID' => '111111112') -
          >type
          > > ('string'),
          > > SOAP::Data->name('LastName' => ''),
          > > SOAP::Data->name('FirstName' => ''),
          > > SOAP::Data->name('MiddleInitial' => ''),
          > > SOAP::Data->name('NotActive' => '1') ->type
          > > ('boolean'),
          > > ...
          > > SOAP::Data->name('StudentPhones'=> [
          > > SOAP::Data->name('StudentPhone'=>
          > > SOAP::Data->name('PhoneNumber'
          > > => ''),
          > > SOAP::Data->name
          > > ('PhoneDescription'=> ''))])]);
          > >
          > > $result = $service -> addLearners($caller,$learner_insert);
          > >
          > >
          > > The XML generated is:
          > >
          > > POST http://USER:PW@SERVER/elms/services/PlateauLMSService
          > > Content-Length: 3384
          > > Content-Type: text/xml
          > >
          SOAPAction: "http://axis.webservices.elms.plateausystems.com#addLearn
          > > ers"
          > >
          > > <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
          xmlns:SOAP-
          > > ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-
          > > ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
          > > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-
          > > ENV="http://schemas.xmlsoap.org/soap/envelope/"
          > > xmlns:xsd="http://www.w3.org/1999/XMLSchema"><SOAP-ENV:Body>
          > >
          > > <namesp1:addLearners
          > > xmlns:namesp1="http://axis.webservices.elms.plateausystems.com">
          > > <Caller SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-
          > > ENC:Array">
          > > <CallerID xsi:type="xsd:string">USER</CallerID>
          > > </Caller>
          > > <Learners SOAP-ENC:arrayType="xsd:ur-type[58]" xsi:type="SOAP-
          > > ENC:Array">
          > > <StudentID xsi:type="xsd:string">111111112</StudentID>
          > > <LastName xsi:type="xsd:string"/>
          > > <FirstName xsi:type="xsd:string"/>
          > > <MiddleInitial xsi:type="xsd:string"/>
          > > <NotActive xsi:type="xsd:boolean">true</NotActive>
          > > ...
          > > <StudentPhones SOAP-ENC:arrayType="xsd:string[2]"
          xsi:type="SOAP-
          > > ENC:Array">
          > > <PhoneNumber xsi:type="xsd:string"/>
          > > <PhoneDescription xsi:type="xsd:string"/>
          > > </StudentPhones>
          > > </Learners>
          > > </namesp1:addLearners>
          > >
          > > </SOAP-ENV:Body></SOAP-ENV:Envelope>
          > >
          > >
          > > The error returned by the SOAP service is:
          > >
          > > <soapenv:Envelope
          > > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
          > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
          > > <soapenv:Body>
          > > <soapenv:Fault>
          > > <faultcode>soapenv:Server.userException</faultcode>
          > > <faultstring>org.xml.sax.SAXException: Invalid element in
          > > com.plateausystems.elms.webservices.axis.AddLearners -
          > > Caller</faultstring>
          > > <detail>
          > > <ns1:hostname
          > > xmlns:ns1="http://xml.apache.org/axis/">SERVER</ns1:hostname>
          > > </detail>
          > > </soapenv:Fault>
          > > </soapenv:Body>
          > > </soapenv:Envelope>
          > >
          > >
          > > Any ideas? Is there an error in my XML?
          > >
          > > Thanks,
          > > Nathaniel Bartusiak
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.