I'm trying to consume a C# WCF Webservice with PHP, and I'm currently facing a really big problem.
First, let me show you what one of the the WCF Webservice responses looks like :
<?xml version="1.0" encoding="UTF-8"?>
<s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:header>
<activityid xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics" correlationid="6b8187a6-79a9-4bc4-a195-7c3b66547408">b340ad42-7be9-466c-a9f1-4048d35b7cb5</activityid>
</s:header>
<s:body>
<getalljobsresponse xmlns="http://tempuri.org/">
<getalljobsresult xmlns:a="http://schemas.datacontract.org/2004/07/Transcode.Webservice.Messages" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:jobinfo>
<a:associatedfilesize>34551192</a:associatedfilesize>
<a:associateduserid>10</a:associateduserid>
<a:jobcompletiondate>2016-06-09T10:37:42.2568136</a:jobcompletiondate>
<a:jobid>29</a:jobid>
<a:jobsubmissiondate>2016-06-09T10:37:27.8522463</a:jobsubmissiondate>
<a:remotefilepath>ftp://localhost/transcode_uploads/Luc/LinkinPark-DontStay.au</a:remotefilepath>
<a:taskprice>0.05</a:taskprice>
<a:taskstate>2</a:taskstate>
</a:jobinfo>
<a:jobinfo>
<a:associatedfilesize>34551192</a:associatedfilesize>
<a:associateduserid>10</a:associateduserid>
<a:jobcompletiondate>2016-06-09T11:46:07.7590635</a:jobcompletiondate>
<a:jobid>1029</a:jobid>
<a:jobsubmissiondate>2016-06-09T11:45:55.8115507</a:jobsubmissiondate>
<a:remotefilepath>ftp://localhost/transcode_uploads/Luc/LinkinPark-DontStay.au</a:remotefilepath>
<a:taskprice>0.05</a:taskprice>
<a:taskstate>2</a:taskstate>
</a:jobinfo>
</getalljobsresult>
</getalljobsresponse>
</s:body>
</s:envelope>
I'm trying everything to get a jobinfo element with all its attributes, but it doesn't seem to work well ...
I tried the following line of code :
$xml->getElementsByTagName('associatedfilesize')->item(0)->nodeValue
And it works on a single attribute, as for jobid or anything else !
The problem is, I would like to get a jobInfo objet in its entirety, by using something like :
$xml->getElementsByTagName('jobInfo')
Could you please help me guys, I have very little time left to finish my work and I'm stuck on that issue for too long...
Related
I need to use soap to get some informations from one of our providers. They gave us the url to call and then left us pretty much in the dark. After searching we understood that the headers they use are different from the standard ones.
We need to send
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tem="http://tempuri.org/"
xmlns:com="http://schemas.datacontract.org/2004/07/Commun.Interfaces.Request">
<soapenv:Header/>
<soapenv:Body>
So we tried to replace the regular header in the XML document by this one. It works, if we plint it before send it looks good.
But after sending we receive an exception :
looks like we got no XML document
and $soap->__getLastRequest() returns :
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://tempuri.org/">
<SOAP-ENV:Body>
The replace has been lost. We tried to send it with CURL also, modifying the XPL before, and the same exception shows up. So we don't really know what to do.
Thanks ahead for any help !
I have following xml file that I have to send as request to a Soap service from a SoapClient in php. I used the SoapVar to create array to sending request but the respond node is not present there. Anyone please , can you help me to convert this xml to array to make request to consume the Soap service
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns4:Send xmlns:ns4="hidden" xmlns="Envelope" xmlns:ns2="hidden" xmlns:ns3="hidden">
<ns4:Pack>
<Envelope>
<Header>
<ID>string</ID>
<StringFirst>string</ns2:StringFirst>
</Header>
<Payload xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns3:SmsMessage">
<ns3:fieldOne>true</ns3:DeliveryReports>
<ns3:fieldTwo xsi:type="ns3:hidden">
<ns3:fieldThree></ns3:ApplicationNumber>
</ns3:fieldTwo>
<ns3:SomeFiled xsi:type="ns3:hidden">
<ns3:number>123</ns3:number>
</ns3:SomeField>
<ns3:Content xsi:type="ns3:hidden">
<ns3:Text>String</ns3:Text>
</ns3:Content>
</Payload>
</Envelope>
</ns4:Pack>
</ns4:Send>
</S:Body>
</S:Envelope>
Thank you in advance
OK, no matter how hard I try I cannot figure the way this works... there is a certain magic attached to all SOAP related object that I cannot really understand...
I want to create the following with the PHP SOAP classes SoapClient, SoapParam etc...
Please help me understand how to do it. I created a somehow complex XML structure so that I can really "get" what is going on...
<env:Envelope>
<env:Body>
<ns:myMethod>
<TheInput xsi:type="ns:TheInputUser">
<ns:username>XXXX</ns:username>
</TheInput>
<TheOutput xsi:type="ns:TheOutUser">
<ns:var xsi:nil="true"/>
</TheOutput>
<Array1 xsi:type="ns:UserArray1"/>
<IdOut xsi:type="xsd:decimal">0</IdOut>
<ErrorOut xsi:type="ns:ErrorUser">
<ns:errorDescr xsi:nil="true"/>
</ErrorOut>
</ns:myMethod>
</env:Body>
</env:Envelope>
thanks in advance
i have a .net service i am consuming from php and the result comes in the format below.
i wish to have only the contents without the soap:envelope.
How do i achieve this?
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><VAccResponse xmlns="http://apps.hbng.com/"><VAccResult><VAccountSummary><Id>C0000005</Id><AccountNo>5100000014</AccountNo><AccountName>xyz HOSPITAL LTD</AccountName><SchemeCode>abc</SchemeCode><SchemeDescription>abc records</SchemeDescription><Balance>6627282</Balance><CurrencyCode>DOLLARS</CurrencyCode><AccountManagerId>F05</AccountManagerId><Debit>0</Debit><Credit>0</Credit><Tran>NO TRANSACTION DONE</Tran></VAccountSummary></VAccResult></VAccResponse></soap:Body></soap:Envelope>
How do i get the xml result without the soap:body, soap envelope etc...
I am using php SOAP to post lead data to my client's SAGE CRM, the record get created (with crmid returned) but contains empty values. For some unknown reason my xml packet is being ignored.
The SAGE documentation does not give an xml example for adding record (addrecord) to the CRM. Can someone please help?
What is the right xml format for addrecord function?
I know this was a question back in 2013 but better have it answered in case someone else comes looking for a solution.
The following is a sample for the upload of a new opportunity into Sage CRM. I have not seen the xml you are generating but I would start by using add instead of addrecord. I have not used addrecord before so I can't help you understanding this format for uploading data.
Please note the *Specified fields as they are important. Any field to be populated which has a related *Specified field must have it set to true. Otherwise the field might not be populated.
Most of the values on the sample bellow must be replaced by actual values. The SID being the most important one.
You may enter multiple <records> within the <add> tags.
<?xml version='1.0' encoding='utf-8' ?>
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<soap:Header>
<SessionHeader xmlns='http://tempuri.org/type'>
<sessionId>SID</sessionId>
</SessionHeader>
</soap:Header>
<soap:Body>
<add xmlns='http://tempuri.org/type'>
<entityname>opportunity</entityname>
<records xsi:type='opportunity'>
<description>description</description>
<forecast>forecast_value</forecast>
<forecastSpecified>true</forecastSpecified>
<certainty>certainty</certainty>
<certaintySpecified>true</certaintySpecified>
<targetclose>targetclose</targetclose>
<targetcloseSpecified>true</targetcloseSpecified>
<forecast_cid>forecast_cid</forecast_cid>
<forecast_cidSpecified>true</forecast_cidSpecified>
<total_cid>total_cid</total_cid>
<total_cidSpecified>true</total_cidSpecified>
<totalorders_cid>total_orders_cid</totalorders_cid>
<totalorders_cidSpecified>true</totalorders_cidSpecified>
<totalquotes_cid>totalquotes_cid</totalquotes_cid>
<totalquotes_cidSpecified>true</totalquotes_cidSpecified>
<source>source</source>
<type>type</type>
<stage>stage</stage>
<status>status</status>
<assigneduserid>assigneduserid</assigneduserid>
<assigneduseridSpecified>true</assigneduseridSpecified>
<channelid>channelid</channelid>
<channelidSpecified>true</channelidSpecified>
<priority>priority</priority>
<currency>cid</currency>
<currencySpecified>true</currencySpecified>
<primarycompanyid>primarycompanyid</primarycompanyid>
<primarycompanyidSpecified>true</primarycompanyidSpecified>
<primarypersonid>primarypersonid</primarypersonid>
<primarypersonidSpecified>true</primarypersonidSpecified>
</records>
</add>
</soap:Body>
</soap:Envelope>
You can find the web services documentation at https://community.sagecrm.com/user_community/m/cloud_documentation/27076.aspx
Download the wsdl file to get more details about each field and entity available.