SOAP请求中的多个complexType元素

时间:2017-04-20 14:50:28

标签: php soap wsdl soap-client

我必须从我的Web应用程序调用SAP SOAP服务。这是WSDL结构:

<xsd:complexType name="ZSD_COT_POSICION">
    <xsd:sequence>
        <xsd:element name="ZCOTIZ_POS" type="tns:char10"/>
        <xsd:element name="POSNR" type="tns:numeric6"/>
    </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="ZSD_COT_CABECERA">
    <xsd:sequence>
        <xsd:element name="MANDT" type="tns:clnt3"/>
        <xsd:element name="ZCOTIZ" type="tns:char10"/>
        <xsd:element name="AUART" type="tns:char4"/>
    </xsd:sequence>
</xsd:complexType>

<xsd:element name="ZSD_COTIZ_RFC">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element name="IS_HEADER" type="tns:ZSD_COT_CABECERA"/>
            <xsd:element name="IT_ITEMS" type="tns:ZSD_TT_COT_POSICION"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>

我正在使用的代码:

<?php   
$SOAP_AUTH = array( 'login'=> 'x', 'password' => 'x', 'exceptions' => true, 'trace' => true );
$WSDL = 'http://someserver:8000/.../zsd_cotiz_rfc/zsd_cotiz_rfc?sap-client=600';
$client = new SoapClient($WSDL,$SOAP_AUTH);
$parameter = new StdClass();    

$parameter->IS_HEADER = new StdClass();     
$parameter->IS_HEADER->MANDT = '';
$parameter->IS_HEADER->ZCOTIZ = 'X099';
$parameter->IS_HEADER->AUART = 'ZTAS';

$parameter->IT_ITEMS = new StdClass();      
$parameter->IT_ITEMS->ZCOTIZ_POS='X099';    
$parameter->IT_ITEMS->POSNR='10';   

$result = $client->ZSD_COTIZ_RFC($parameter);
?>

但不仅仅是不工作(内部服务器错误),但如果我检查XML我发送它缺少“IT_ITEMS”数组:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:sap-com:document:sap:rfc:functions">
<SOAP-ENV:Body>
<ns1:ZSD_COTIZ_RFC>
<IS_HEADER>
    <MANDT></MANDT><ZCOTIZ>X099</ZCOTIZ><AUART>ZTAS</AUART>
</IS_HEADER>

<IT_ITEMS/>
</ns1:ZSD_COTIZ_RFC>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

我花了很多时间尝试一切。

0 个答案:

没有答案