创建Soap客户端请求

时间:2016-01-28 03:39:52

标签: php xml soap wsdl

我需要为下面的wsdl创建一个Soap请求。

<?xml version='1.0' encoding='UTF-8'?>
<definitions xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://services.adjustinvoice.claims.facade.services.mednext.mni.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://services.adjustinvoice.claims.facade.services.mednext.mni.com/" name="AdjustInvoice">
    <types>
        <xsd:schema>
            <xsd:import namespace="http://services.adjustinvoice.claims.facade.services.mednext.mni.com/" schemaLocation="http://192.168.50.12:8001/MedNeXtWebServices/AdjustInvoice?xsd=1"/>
        </xsd:schema>
    </types>
    <message name="AdjustInvoice">
        <part name="parameters" element="tns:AdjustInvoice"/>
    </message>
    <message name="AdjustInvoiceResponse">
        <part name="parameters" element="tns:AdjustInvoiceResponse"/>
    </message>
    <portType name="AdjustInvoice">
        <operation name="AdjustInvoice">
            <input message="tns:AdjustInvoice"/>
            <output message="tns:AdjustInvoiceResponse"/>
        </operation>
    </portType>
    <binding name="AdjustInvoiceEJBBeanPortBinding" type="tns:AdjustInvoice">
        <soap12:binding transport="http://www.w3.org/2003/05/soap/bindings/HTTP/" style="document"/>
        <operation name="AdjustInvoice">
            <soap12:operation soapAction=""/>
            <input>
                <soap12:body use="literal"/>
            </input>
            <output>
                <soap12:body use="literal"/>
            </output>
        </operation>
    </binding>
    <service name="AdjustInvoice">
        <port name="AdjustInvoiceEJBBeanPort" binding="tns:AdjustInvoiceEJBBeanPortBinding">
            <soap12:address location="http://192.168.50.12:8001/MedNeXtWebServices/AdjustInvoice"/>
        </port>
    </service>
</definitions>

我使用here中的array_to_objecttree函数生成数组,但无法生成xsi:nil="true"

这是我到目前为止所做的。

                        $data = array(
                              'adjustInvoiceRequest' => array(
                                'AdjustmentUser' => "TEST",
                                'InvoiceAdjustments' => array(  
                                  'InvoiceAdjustment' => array(
                                    'InvoiceNumber' => '9046184',
                                    'AdjustmentDate' => '2016-01-27T00:00:00',
                                    'ReceivedDate' => '2016-01-27T00:00:00',
                                    'AdjustmentType' => 'CANINV',
                                    'Reason' => NULL,
                                    'Notes' => NULL,
                                    'AuditNumber' => NULL,
                                    'RepositionType' => 'LSTNN',
                                    'SubmittedBy' => '05',
                                    'User' => 'TEST'
                                  )
                                )
                              )
                            );

这是我上述代码的要求。

<?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://services.adjustinvoice.claims.facade.services.mednext.mni.com/">
        <SOAP-ENV:Body>
            <ns1:AdjustInvoice>
                <AdjustInvoiceRequest>
                    <AdjustmentUser>TEST</AdjustmentUser>
                    <InvoiceAdjustments>
                        <InvoiceAdjustment>
                        <InvoiceNumber>9046184</InvoiceNumber>
                        <AdjustmentDate>2016-01-27T00:00:00</AdjustmentDate>
                        <ReceivedDate>2016-01-27T00:00:00</ReceivedDate>
                        <AdjustmentType>CANINV</AdjustmentType>
                        <Reason xsi:nil="true"/>
                        <Notes xsi:nil="true"/>
                        <AuditNumber xsi:nil="true"/>
                        <RepositionType>LSTNN</RepositionType>
                        <SubmittedBy>05</SubmittedBy>
                        <User>TEST</User>
                        </InvoiceAdjustment>
                    </InvoiceAdjustments>
                </AdjustInvoiceRequest>
            </ns1:AdjustInvoice>
        </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

如何以下列格式创建Soap请求

<adjustInvoiceRequest>
    <AdjustmentUser>TEST</AdjustmentUser>
    <InvoiceAdjustments>
        <InvoiceAdjustment>
            <InvoiceNumber>9046375</InvoiceNumber>
            <AdjustmentDate>2016-01-27T14:57:31.0367916+04:00</AdjustmentDate>
            <ReceivedDate>2016-01-27T14:57:31.0367916+04:00</ReceivedDate>
            <AdjustmentType>CANINV</AdjustmentType>
            <Reason xsi:nil="true"/>
            <Notes xsi:nil="true"/>
            <AuditNumber xsi:nil="true"/>
            <RepositionType>LSTNN</RepositionType>
            <SubmittedBy>05</SubmittedBy>
            <SubmittersName xsi:nil="true"/>
            <ProviderCode xsi:nil="true"/>
            <User>TEST</User>
        </InvoiceAdjustment>
    </InvoiceAdjustments>
</adjustInvoiceRequest>

0 个答案:

没有答案