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

Complex data type

Expand Messages
  • pgfarr
    I am trying to build a SOAP request with the following structure:
    Message 1 of 3 , Aug 28 10:21 AM
    • 0 Attachment
      I am trying to build a SOAP request with the following structure:
      <?xml version="1.0" encoding="UTF-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns="http://www.alarmpoint.com/webservices/schema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
      <ns:AddGroup>
      <ns:user xsi:type="xsd:string">ws_user1</ns:user>
      <ns:password xsi:type="xsd:string">LetMeIn</ns:password>
      <ns:clientTimestamp />
      <ns:clientIP />
      <ns:clientOSUser />
      <ns:company xsi:type="xsd:string">Default Company</ns:company>

      <ns:group>
      <ns:active xsi:type="xsd:int">1</ns:active>
      <ns:allowDuplicates xsi:type="xsd:int">1</ns:allowDuplicates>
      <ns:description xsi:type="xsd:string">New group</ns:description>
      <ns:externallyOwned xsi:type="xsd:int">1</ns:externallyOwned>
      <ns:name xsi:type="xsd:string">Test Group</ns:name>
      <ns:observedByAll xsi:type="xsd:string" />
      <ns:observers xsi:type="xsd:string" />
      <ns:site xsi:type="xsd:string" />
      <ns:supervisors /><ns:timeZone xsi:type="xsd:string" />
      <ns:useDefaultDevices xsi:type="xsd:int">1</ns:useDefaultDevices>
      </ns:group>
      </ns:AddGroup>
      </soap:Body>
      </soap:Envelope>

      using the following code fragment:

      my $ap_response = $SOAP->call(
      SOAP::Data->name( 'ns:AddGroup' ) =>
      SOAP::Data->name( 'ns:user'=> $WS_USER),
      SOAP::Data->name( 'ns:password'=> $WS_PASSWD),
      SOAP::Data->name( 'ns:clientTimestamp'),
      SOAP::Data->name( 'ns:clientIP'),
      SOAP::Data->name( 'ns:clientOSUser'),
      SOAP::Data->name( 'ns:company'=> $COMPANY),
      SOAP::Data->name( 'ns:group' ) =>
      SOAP::Data->name( "ns:active"=> 1 ),
      SOAP::Data->name( "ns:allowDuplicates"=> 1 ),
      SOAP::Data->name( "ns:description"=> 'New group' ),
      SOAP::Data->name( "ns:externallyOwned"=> 1 ),
      SOAP::Data->name( "ns:name" => $GROUP ),
      SOAP::Data->name( "ns:observedByAll" => '' ),
      SOAP::Data->name( "ns:observers" => '' ),
      SOAP::Data->name( "ns:site" => '' ),
      SOAP::Data->name( "ns:supervisors" ) ,
      SOAP::Data->name( "ns:timeZone" => '' ),
      SOAP::Data->name( "ns:useDefaultDevices" => 1 )
      );

      Unfortunately the actual XML emitted is:

      <?xml version="1.0" encoding="UTF-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns="http://www.alarmpoint.com/webservices/schema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
      <ns:AddGroup>
      <ns:user xsi:type="xsd:string">ws_user1</ns:user>
      <ns:password xsi:type="xsd:string">LetMeIn</ns:password>
      <ns:clientTimestamp />
      <ns:clientIP />
      <ns:clientOSUser />
      <ns:company xsi:type="xsd:string">Default Company</ns:company>
      <ns:group />
      <ns:active xsi:type="xsd:int">1</ns:active>
      <ns:allowDuplicates xsi:type="xsd:int">1</ns:allowDuplicates>
      <ns:description xsi:type="xsd:string">New group</ns:description>
      <ns:externallyOwned xsi:type="xsd:int">1</ns:externallyOwned>
      <ns:name xsi:type="xsd:string">Test Group</ns:name>
      <ns:observedByAll xsi:type="xsd:string" />
      <ns:observers xsi:type="xsd:string" />
      <ns:site xsi:type="xsd:string" />
      <ns:supervisors /><ns:timeZone xsi:type="xsd:string" />
      <ns:useDefaultDevices xsi:type="xsd:int">1</ns:useDefaultDevices>
      </ns:AddGroup>
      </soap:Body>
      </soap:Envelope>

      What am I doing wrong this time? Why is the group node showing up this way?
    • Martin Busik
      Hi, ... SOAP::Data- name( ns:group ) = value is the same as SOAP::Data- name( ns:group ), value which means an empty element named ns:group followed by
      Message 2 of 3 , Aug 29 7:14 AM
      • 0 Attachment
        Hi,

        > What am I doing wrong this time? Why is the group node
        > showing up this way?

        SOAP::Data->name( 'ns:group' ) => value

        is the same as

        SOAP::Data->name( 'ns:group' ), value

        which means an empty element named 'ns:group' followed by an another
        element, which is the serialized "value".

        You have to use the following:

        SOAP::Data->name('ns:group')->value( ... )

        Important: the content of value must be a reference to da SOAP::Data object
        (to disable some SOAP::Lite-Type-magic), e.g.:

        SOAP::Data->name( 'ns:group')->value (
        \SOAP::Data->value(
        SOAP::Data->name( "ns:active"=> 1 ),
        ...

        So, to create the whole request, use:

        my $ap_response = $AP->call( SOAP::Data->name( 'ns:AddGroup' ),
        SOAP::Data->name( 'ns:user'=> $WS_USER),
        SOAP::Data->name( 'ns:password'=> $WS_PASSWD),
        SOAP::Data->name( 'ns:clientTimestamp'),
        SOAP::Data->name( 'ns:clientIP'),
        SOAP::Data->name( 'ns:clientOSUser'),
        SOAP::Data->name( 'ns:company'=> $COMPANY),
        SOAP::Data->name( 'ns:group')->value (
        \SOAP::Data->value(
        SOAP::Data->name( "ns:active"=> 1 ),
        SOAP::Data->name( "ns:allowDuplicates"=> 1 ),
        SOAP::Data->name( "ns:description"=> 'New group' ),
        SOAP::Data->name( "ns:externallyOwned"=> 1 ),
        )
        )
        );

        Cheers,
        Martin





        > -----Urspr√ľngliche Nachricht-----
        > Von: soaplite@yahoogroups.com
        > [mailto:soaplite@yahoogroups.com] Im Auftrag von pgfarr
        > Gesendet: Freitag, 28. August 2009 19:21
        > An: soaplite@yahoogroups.com
        > Betreff: [soaplite] Complex data type
        >
        > I am trying to build a SOAP request with the following structure:
        > <?xml version="1.0" encoding="UTF-8"?>
        > <soap:Envelope
        > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:ns="http://www.alarmpoint.com/webservices/schema"
        > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        > <soap:Body>
        > <ns:AddGroup>
        > <ns:user xsi:type="xsd:string">ws_user1</ns:user>
        > <ns:password xsi:type="xsd:string">LetMeIn</ns:password>
        > <ns:clientTimestamp />
        > <ns:clientIP />
        > <ns:clientOSUser />
        > <ns:company xsi:type="xsd:string">Default Company</ns:company>
        >
        > <ns:group>
        > <ns:active xsi:type="xsd:int">1</ns:active>
        > <ns:allowDuplicates xsi:type="xsd:int">1</ns:allowDuplicates>
        > <ns:description xsi:type="xsd:string">New group</ns:description>
        > <ns:externallyOwned xsi:type="xsd:int">1</ns:externallyOwned>
        > <ns:name xsi:type="xsd:string">Test Group</ns:name>
        > <ns:observedByAll xsi:type="xsd:string" />
        > <ns:observers xsi:type="xsd:string" />
        > <ns:site xsi:type="xsd:string" />
        > <ns:supervisors /><ns:timeZone xsi:type="xsd:string" />
        > <ns:useDefaultDevices
        > xsi:type="xsd:int">1</ns:useDefaultDevices>
        > </ns:group>
        > </ns:AddGroup>
        > </soap:Body>
        > </soap:Envelope>
        >
        > using the following code fragment:
        >
        > my $ap_response = $SOAP->call(
        > SOAP::Data->name( 'ns:AddGroup' ) =>
        > SOAP::Data->name( 'ns:user'=> $WS_USER),
        > SOAP::Data->name( 'ns:password'=> $WS_PASSWD),
        > SOAP::Data->name( 'ns:clientTimestamp'),
        > SOAP::Data->name( 'ns:clientIP'),
        > SOAP::Data->name( 'ns:clientOSUser'),
        > SOAP::Data->name( 'ns:company'=> $COMPANY),
        > SOAP::Data->name( 'ns:group' ) =>
        > SOAP::Data->name( "ns:active"=> 1 ),
        > SOAP::Data->name( "ns:allowDuplicates"=> 1 ),
        > SOAP::Data->name( "ns:description"=> 'New group' ),
        > SOAP::Data->name( "ns:externallyOwned"=> 1 ),
        > SOAP::Data->name( "ns:name" => $GROUP ),
        > SOAP::Data->name( "ns:observedByAll" => '' ),
        > SOAP::Data->name( "ns:observers" => '' ),
        > SOAP::Data->name( "ns:site" => '' ),
        > SOAP::Data->name( "ns:supervisors" ) ,
        > SOAP::Data->name( "ns:timeZone" => '' ),
        > SOAP::Data->name( "ns:useDefaultDevices" => 1 )
        > );
        >
        > Unfortunately the actual XML emitted is:
        >
        > <?xml version="1.0" encoding="UTF-8"?>
        > <soap:Envelope
        > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:ns="http://www.alarmpoint.com/webservices/schema"
        > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        > <soap:Body>
        > <ns:AddGroup>
        > <ns:user xsi:type="xsd:string">ws_user1</ns:user>
        > <ns:password xsi:type="xsd:string">LetMeIn</ns:password>
        > <ns:clientTimestamp />
        > <ns:clientIP />
        > <ns:clientOSUser />
        > <ns:company xsi:type="xsd:string">Default Company</ns:company>
        > <ns:group />
        > <ns:active xsi:type="xsd:int">1</ns:active>
        > <ns:allowDuplicates xsi:type="xsd:int">1</ns:allowDuplicates>
        > <ns:description xsi:type="xsd:string">New group</ns:description>
        > <ns:externallyOwned xsi:type="xsd:int">1</ns:externallyOwned>
        > <ns:name xsi:type="xsd:string">Test Group</ns:name>
        > <ns:observedByAll xsi:type="xsd:string" />
        > <ns:observers xsi:type="xsd:string" />
        > <ns:site xsi:type="xsd:string" />
        > <ns:supervisors /><ns:timeZone xsi:type="xsd:string" />
        > <ns:useDefaultDevices xsi:type="xsd:int">1</ns:useDefaultDevices>
        > </ns:AddGroup>
        > </soap:Body>
        > </soap:Envelope>
        >
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
      • pgfarr
        Excellent! Thanks Martin, that worked. On to new errors!!!
        Message 3 of 3 , Sep 1, 2009
        • 0 Attachment
          Excellent! Thanks Martin, that worked.

          On to new errors!!!

          --- In soaplite@yahoogroups.com, "Martin Busik" <martin.busik@...> wrote:
          >
          > Hi,
          >
          > > What am I doing wrong this time? Why is the group node
          > > showing up this way?
          >
          > SOAP::Data->name( 'ns:group' ) => value
          >
          > is the same as
          >
          > SOAP::Data->name( 'ns:group' ), value
          >
          > which means an empty element named 'ns:group' followed by an another
          > element, which is the serialized "value".
          >
          > You have to use the following:
          >
          > SOAP::Data->name('ns:group')->value( ... )
          >
          > Important: the content of value must be a reference to da SOAP::Data object
          > (to disable some SOAP::Lite-Type-magic), e.g.:
          >
          > SOAP::Data->name( 'ns:group')->value (
          > \SOAP::Data->value(
          > SOAP::Data->name( "ns:active"=> 1 ),
          > ...
          >
          > So, to create the whole request, use:
          >
          > my $ap_response = $AP->call( SOAP::Data->name( 'ns:AddGroup' ),
          > SOAP::Data->name( 'ns:user'=> $WS_USER),
          > SOAP::Data->name( 'ns:password'=> $WS_PASSWD),
          > SOAP::Data->name( 'ns:clientTimestamp'),
          > SOAP::Data->name( 'ns:clientIP'),
          > SOAP::Data->name( 'ns:clientOSUser'),
          > SOAP::Data->name( 'ns:company'=> $COMPANY),
          > SOAP::Data->name( 'ns:group')->value (
          > \SOAP::Data->value(
          > SOAP::Data->name( "ns:active"=> 1 ),
          > SOAP::Data->name( "ns:allowDuplicates"=> 1 ),
          > SOAP::Data->name( "ns:description"=> 'New group' ),
          > SOAP::Data->name( "ns:externallyOwned"=> 1 ),
          > )
          > )
          > );
          >
          > Cheers,
          > Martin
          >
          >
          >
          >
          >
          > > -----Urspr√ľngliche Nachricht-----
          > > Von: soaplite@yahoogroups.com
          > > [mailto:soaplite@yahoogroups.com] Im Auftrag von pgfarr
          > > Gesendet: Freitag, 28. August 2009 19:21
          > > An: soaplite@yahoogroups.com
          > > Betreff: [soaplite] Complex data type
          > >
          > > I am trying to build a SOAP request with the following structure:
          > > <?xml version="1.0" encoding="UTF-8"?>
          > > <soap:Envelope
          > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
          > > xmlns:ns="http://www.alarmpoint.com/webservices/schema"
          > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          > > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
          > > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
          > > <soap:Body>
          > > <ns:AddGroup>
          > > <ns:user xsi:type="xsd:string">ws_user1</ns:user>
          > > <ns:password xsi:type="xsd:string">LetMeIn</ns:password>
          > > <ns:clientTimestamp />
          > > <ns:clientIP />
          > > <ns:clientOSUser />
          > > <ns:company xsi:type="xsd:string">Default Company</ns:company>
          > >
          > > <ns:group>
          > > <ns:active xsi:type="xsd:int">1</ns:active>
          > > <ns:allowDuplicates xsi:type="xsd:int">1</ns:allowDuplicates>
          > > <ns:description xsi:type="xsd:string">New group</ns:description>
          > > <ns:externallyOwned xsi:type="xsd:int">1</ns:externallyOwned>
          > > <ns:name xsi:type="xsd:string">Test Group</ns:name>
          > > <ns:observedByAll xsi:type="xsd:string" />
          > > <ns:observers xsi:type="xsd:string" />
          > > <ns:site xsi:type="xsd:string" />
          > > <ns:supervisors /><ns:timeZone xsi:type="xsd:string" />
          > > <ns:useDefaultDevices
          > > xsi:type="xsd:int">1</ns:useDefaultDevices>
          > > </ns:group>
          > > </ns:AddGroup>
          > > </soap:Body>
          > > </soap:Envelope>
          > >
          > > using the following code fragment:
          > >
          > > my $ap_response = $SOAP->call(
          > > SOAP::Data->name( 'ns:AddGroup' ) =>
          > > SOAP::Data->name( 'ns:user'=> $WS_USER),
          > > SOAP::Data->name( 'ns:password'=> $WS_PASSWD),
          > > SOAP::Data->name( 'ns:clientTimestamp'),
          > > SOAP::Data->name( 'ns:clientIP'),
          > > SOAP::Data->name( 'ns:clientOSUser'),
          > > SOAP::Data->name( 'ns:company'=> $COMPANY),
          > > SOAP::Data->name( 'ns:group' ) =>
          > > SOAP::Data->name( "ns:active"=> 1 ),
          > > SOAP::Data->name( "ns:allowDuplicates"=> 1 ),
          > > SOAP::Data->name( "ns:description"=> 'New group' ),
          > > SOAP::Data->name( "ns:externallyOwned"=> 1 ),
          > > SOAP::Data->name( "ns:name" => $GROUP ),
          > > SOAP::Data->name( "ns:observedByAll" => '' ),
          > > SOAP::Data->name( "ns:observers" => '' ),
          > > SOAP::Data->name( "ns:site" => '' ),
          > > SOAP::Data->name( "ns:supervisors" ) ,
          > > SOAP::Data->name( "ns:timeZone" => '' ),
          > > SOAP::Data->name( "ns:useDefaultDevices" => 1 )
          > > );
          > >
          > > Unfortunately the actual XML emitted is:
          > >
          > > <?xml version="1.0" encoding="UTF-8"?>
          > > <soap:Envelope
          > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
          > > xmlns:ns="http://www.alarmpoint.com/webservices/schema"
          > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          > > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
          > > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
          > > <soap:Body>
          > > <ns:AddGroup>
          > > <ns:user xsi:type="xsd:string">ws_user1</ns:user>
          > > <ns:password xsi:type="xsd:string">LetMeIn</ns:password>
          > > <ns:clientTimestamp />
          > > <ns:clientIP />
          > > <ns:clientOSUser />
          > > <ns:company xsi:type="xsd:string">Default Company</ns:company>
          > > <ns:group />
          > > <ns:active xsi:type="xsd:int">1</ns:active>
          > > <ns:allowDuplicates xsi:type="xsd:int">1</ns:allowDuplicates>
          > > <ns:description xsi:type="xsd:string">New group</ns:description>
          > > <ns:externallyOwned xsi:type="xsd:int">1</ns:externallyOwned>
          > > <ns:name xsi:type="xsd:string">Test Group</ns:name>
          > > <ns:observedByAll xsi:type="xsd:string" />
          > > <ns:observers xsi:type="xsd:string" />
          > > <ns:site xsi:type="xsd:string" />
          > > <ns:supervisors /><ns:timeZone xsi:type="xsd:string" />
          > > <ns:useDefaultDevices xsi:type="xsd:int">1</ns:useDefaultDevices>
          > > </ns:AddGroup>
          > > </soap:Body>
          > > </soap:Envelope>
          > >
          > >
          > >
          > >
          > > ------------------------------------
          > >
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.