XML : Creating request for Soap client

I need to create a Soap request for the below wsdl.

  <?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>    

I used the array_to_objecttree function from here to generate the array but was not able to generate xsi:nil="true".

This is what I have done so far.

                          $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'                                    )                                  )                                )                              );    

And this is my request from above code.

  <?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>    

How can I create the Soap request in the following format

  <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>    

No comments:

Post a Comment