スキーマ内でwsdl:arrayType属性を使用したSOAP配列の宣言
SOAPでエンコードされた配列のWSDLでは、スキーマ内でwsdl:arrayType
属性を使用してSOAP配列を宣言できます。次の例に詳細を示します。
<xsd:complexType name="UserObject"> <xsd:sequence> <xsd:element name="userInformation" nillable="true" type="n5:ArrayOfKeyValuePair"/> <xsd:element name="username" nillable="true" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="ArrayOfKeyValuePair"> <xsd:complexContent> <xsd:restriction base="soapenc:Array"> <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="n5:KeyValuePair[]"/> </xsd:restriction> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="KeyValuePair"> <xsd:sequence> <xsd:element name="key" nillable="true" type="xsd:string"/> <xsd:element name="value" nillable="true" type="xsd:string"/> </xsd:sequence> </xsd:complexType>
次の例に、BPEL 1.1でSOAPでエンコードされた配列を作成してアクセスする方法を示します。
<bpws:copy> <bpws:from> <ns1:userInformation soapenc:arrayType="com1:KeyValuePair[1]" xmlns:ns1="http://www.schematargetnamespace.com/wsdl/Impl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"/> <ns1:KeyValuePair xmlns:ns1="http://www.schematargetnamespace.com/wsdl/Impl/"> <key>testkey</key> <value>testval1</value> </ns1:KeyValuePair> </ns1:userInformation> </bpws:from> <bpws:to variable="Inputvar" part="userObject" query="/userObject/userInformation"/> </bpws:copy> <!--Update elements with SOAPENC Array--> <bpws:copy> <bpws:from variable="KeyValueVar" part="KeyValuePair" query="/KeyValuePair/ns2:key"/> <bpws:to variable="Inputvar" part="userObject' query="//*[local-name()='KeyValuePair'][1]/*[local-name()='key']"/> </bpws:copy> <bpws:copy> <bpws:from variable="KeyValueVar" part="KeyValuePair" query="/KeyValuePair/client:value"/> <bpws:to variable="Inputvar" part="userObject" query="//*[local-name()='KeyValuePair'][1]/*[local-name()='value']"/> </bpws:copy> <!-- Append elements within SOAPENC Array --> <bpelx:append> <bpelx:from variable="Inputvar" part="userObject" query="//*[local-name()='KeyValuePair'][1]"/> <bpelx:to variable="Inputvar" part="userObject" query="/userObject/userInformation"/> </bpelx:append>