cancel
Showing results for 
Search instead for 
Did you mean: 

Soap Array in external WSDL

Former Member
0 Kudos

Hi all,

i have an webservice that i need to use as a reciever that has a WSDL containing soap arrays instead of repeating groups.

<xsd:complexType name="workOrderArray">

<xsd:complexContent>

<xsd:restriction base="soapenc:Array">

<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="tns:workOrder[]" />

</xsd:restriction>

</xsd:complexContent>

</xsd:complexType>

i understand that PI is not supporting this but maybe somebody has found a work around ? At the moment i 'm creating an XSD from the WSDL and then i will import the xml schema and i will see if that works.

any other suggestions ?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I have used the following in a different product and it worked fine. You could give it a try in XI. This approach adjusts the WSDL itself rather than creating a separate XSD. Still not ideal, but closer to the original. In the WSDL, comment out the original workOrderArray complexType and add the new one showing below.


      <!-- CHANGED: Document why this has changed...  
      <xsd:complexType name="workOrderArray">
        <xsd:complexContent>
          <xsd:restriction base="soapenc:Array">
            <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="tns:workOrder[]"/>
          </xsd:restriction>
        </xsd:complexContent>
      </xsd:complexType>
      -->

      <xsd:complexType name="workOrderArray">
        <xsd:sequence>
          <xsd:element name="workOrder" type="tns:workOrder" maxOccurs="unbounded"/>
        </xsd:sequence>
      </xsd:complexType>

Thanks,

-Russ

Edited by: Russell Darr on Aug 4, 2009 5:57 PM

Former Member
0 Kudos

thanks for the reply

but i have tried this already and the receiver site is expectening the sopa array encoding

any other ideas ?

Former Member
0 Kudos

Perhaps someone else will give you a better approach, but I would probably look at using xslt. Either for the entire map or as a second step in your interface mapping. XSLT will let you fine tune the message if there are some issues with formatting. My example below will create the entire soap message. Depending on what you need you many not want/need it. If you do add the soap envelope in xslt, then you will need to set u201CDo Not Use SOAP Envelopeu201D in the communication channel so it doesnu2019t try to add a second envelope.

Hereu2019s my made up input message for the xslt below.


<workOrderMsg xmlns="http://example/">
  <header>
     <header1>header_1</header1>
     <header2>header_2</header2>
  </header>
  <workOrderArray>
    <workOrder>
      <order_id>order_id_1</order_id>
      <description>description_1</description>
    </workOrder>
    <workOrder>
      <order_id>order_id_1</order_id>
      <description>description_1</description>
    </workOrder>
  </workOrderArray>
</workOrderMsg>

Former Member
0 Kudos

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:tns="http://example/"
  xmlns:types="http://example/encodedTypes"
  xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">

  <xsl:template match="/">
    <env:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://example/" xmlns:types="http://example/encodedTypes" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <env:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <xsl:copy>
          <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
      </env:Body>
    </env:Envelope>
  </xsl:template>

  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="/tns:workOrderMsg/tns:workOrderArray">
    <workOrderArray soapenc:id="id1" soapenc:itemType="types:WorkOrder">
      <xsl:attribute name="soapenc:arraySize">
        <xsl:value-of select="count(./tns:workOrder)"/>
      </xsl:attribute>
      <xsl:for-each select="./tns:workOrder">
        <Item>
          <xsl:attribute name="soapenc:id">
            <xsl:value-of select="concat('id', position())"/>
          </xsl:attribute>
          <order_id xsi:type="xsd:string"><xsl:value-of select="tns:order_id"/></order_id>
          <description xsi:type="xsd:string"><xsl:value-of select="tns:description"/></description>
        </Item>
      </xsl:for-each>
    </workOrderArray>
  </xsl:template>
</xsl:stylesheet>
Former Member
0 Kudos

XML output:


<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:types="http://example/encodedTypes" xmlns:tns="http://example/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <env:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <workOrderMsg xmlns="http://example/">
      <header>
        <header1>header_1</header1>
        <header2>header_2</header2>
      </header>
      <workOrderArray xmlns="" soapenc:itemType="types:WorkOrder" soapenc:id="id1" soapenc:arraySize="2">
        <Item soapenc:id="id1">
          <order_id xsi:type="xsd:string">order_id_1</order_id>
          <description xsi:type="xsd:string">description_1</description>
        </Item>
        <Item soapenc:id="id2">
          <order_id xsi:type="xsd:string">order_id_1</order_id>
          <description xsi:type="xsd:string">description_1</description>
        </Item>
      </workOrderArray>
    </workOrderMsg>
  </env:Body>
</env:Envelope>

Former Member
0 Kudos

Hi Russell Darr,

Worked for me! Thanks.

Best regards.