I would like it so customers don't have to travel off site to see their tracking info:(In other words they can track their shipment from my website) http://www.echo.com/ShipmentTracking/EchoShipmentTrack.aspx
I received the API documentation and I was able to test a remote API with SOAPUI successfully. I see that it has several tools to generating code for things like Java. I looked for a SoapUI to PHP tool but was unable to find one. I'm very new to PHP, could anyone give the code of how I could translate this XML into something that I could execute on a web server?
WSDL link: http://api.echo.com/Echo.API.ShipmentStatus/ShipmentStatusService.svc?wsdl
Sample Request generated by SOAPUI:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://api.echo.com/shipmentstatus/contracts/2012/02/" xmlns:ns1="http://api.echo.com/common/schemas/2012/02/" xmlns:ns2="http://api.echo.com/shipmentstatus/schemas/2012/02/">
<soapenv:Header/>
<soapenv:Body>
<ns:GetStatus>
<ns:getStatusRequest>
<ns1:UserCredentials>
<ns1:APIKey>------REMOVED-----</ns1:APIKey>
</ns1:UserCredentials>
<ns2:BatchProcessingOptions>
<ns1:NotificationOptions>
<ns1:NotifyByEmail>false</ns1:NotifyByEmail>
<ns1:NotifyEmail>dchol#echo.com</ns1:NotifyEmail>
</ns1:NotificationOptions>
<ns1:ShouldPartialProcessBatch>false</ns1:ShouldPartialProcessBatch>
<ns2:CostResultFormat>DETAIL</ns2:CostResultFormat>
<ns2:IncludeCostDetails>false</ns2:IncludeCostDetails>
<ns2:StatusResultFormat>DETAIL</ns2:StatusResultFormat>
</ns2:BatchProcessingOptions>
<ns2:ShipmentIdentifiers>
<ns1:ShipmentIdentifier>
<ns1:ShipmentAccountNumber>E9704</ns1:ShipmentAccountNumber>
<ns1:ShipmentNumber>17596853</ns1:ShipmentNumber>
</ns1:ShipmentIdentifier>
</ns2:ShipmentIdentifiers>
</ns:getStatusRequest>
</ns:GetStatus>
</soapenv:Body>
</soapenv:Envelope>
This question already have a solutions at stackoverflow.
Look at this answers:
https://stackoverflow.com/a/10505172/2324993
https://stackoverflow.com/a/1656763/2324993
Related
I am trying to send a SOAP request via PHP and while I am able to send via SOAPUI, I am having an issue formatting in PHP. The schema, located here shows an attribute embedded in the routePartitionName element which is where my code is falling apart. I need to send the pattern and routePartitionName in my array. Here is part of the SOAP request that is working:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/12.5">
<soapenv:Header/>
<soapenv:Body>
<ns:getLine sequence="?">
<pattern>6304389152</pattern>
<routePartitionName uuid="{BE888889-7C30-4C89-0CC4 C99FDE1025A9}">NA_DID_XLATE_PT</routePartitionName>
<returnedTags uuid="?">
.....
.....
</returnedTags>
Here is what I am sending in PHP that does not work:
$lineinfo = array("routePartitionName"=>"uuid={BE888889-7C30-4C89-0CC4-C99FDE1025A9}",
"pattern"=>"6304389152");
The logs show `[soapenv:Server] Item not valid: The specified uuid={BE888889-7C30-4C89-0CC4-C99FDE1025A9} was not found `
Can someone let me know what I am missing here?
Thanks.
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 !
How can I generate this schema using php soap client cant seem to get a way
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:loc="http://www.csapi.org/schema/parlayx/subscribe/manage/v1_0/local">
<soapenv:Header>
<tns:RequestSOAPHeader xmlns:tns="http://www.namesapace.com/common/v2_1">
<tns:one>***</tns:one>
<tns:two>***</tns:three>
<oauth_token>***</oauth_token>
</tns:RequestSOAPHeader>
</soapenv:Header>
<soapenv:Body>
<loc:ProductRequest>
<subInfo>
<productID>***</productID>
<isAutoExtend>0</isAutoExtend>
</subInfo>
</loc:ProductRequest>
</soapenv:Body>
</soapenv:Envelope>
On top of using the client, sometimes it may not bind to the namespace especially if using different soap versions or other strange reasons. Solved it by overriding the soap class and replacing the ns1 and ns2 values as described here http://php.net/manual/en/soapclient.dorequest.php#74123
IF no success with php soapclient, just post the request with curl.
Example in this answer - SOAP request in PHP with CURL
I was trying to find some examples how to write binding.xml with JiBX/PiBX for following SOAP response but with no luck. Does anyone know how to do this?
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns6:getDataResp xmlns:ns6="http://domain.com/response/data/">
<s3:requestId xmlns:s3="http://domain.com/entity/">12</s3:requestId>
<s4:errorCode xmlns:s3="http://domain.com/entity1/">0</s4:errorCode>
<ns6:dataResp>
<ns5:Data>Some string data</ns5:Data>
</ns6:dataResp>
</ns6:getDataResp>
</soapenv:Body>
</soapenv:Envelope>
If you are using JiBX you're in luck. You have a couple of options:
The apache cxf project has a databinding module for JiBX. You can use one of the open-source web servers such as servicemix to do your SOAP handling. This means you only have to bind the message schema (getDataResp in your example) with JiBX. You can find a nice example, here.
JiBX has it's own web server called JiBX/WS. It will also do all the SOAP handling for you.
I hope this helps!
Don
JiBX contributor
I am new to salesforce. Proficient in php but I haven't done any xml parsing. I have this file which I can consume. It is created when a salesforce object changes:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<notifications xmlns="http://soap.sforce.com/2005/09/outbound">
<OrganizationId>00D30000000opwSEAQ</OrganizationId>
<ActionId>04k30000000L6QPAA0</ActionId>
<SessionId xsi:nil="true"/>
<EnterpriseUrl>https://na1-api.salesforce.com/services/Soap/c/22.0/00D30000000opwS</EnterpriseUrl>
<PartnerUrl>https://na1-api.salesforce.com/services/Soap/u/22.0/00D30000000opwS</PartnerUrl>
<Notification>
<Id>04l3000000JbKClAAN</Id>
<sObject xsi:type="sf:Account" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<sf:Id>0013000000ooziWAAQ</sf:Id>
<sf:BillingCity>New York</sf:BillingCity>
<sf:BillingCountry>US</sf:BillingCountry>
<sf:BillingPostalCode>10000</sf:BillingPostalCode>
<sf:BillingState>New York</sf:BillingState>
<sf:BillingStreet>302 E xxx St Apt C</sf:BillingStreet>
<sf:FN__Mapping_Status__c>Not Located Yet</sf:FN__Mapping_Status__c>
<sf:IsDeleted>false</sf:IsDeleted>
<sf:Member_Status__c>Active</sf:Member_Status__c>
<sf:Name>Joel Test</sf:Name>
</sObject>
</Notification>
</notifications>
</soapenv:Body>
</soapenv:Envelope>
I need to parse it so that I can take the values in the sf namespace and update a database. I can use SimpleXML to read stuff no in namespace, but I haven't been able to read namespace values. Can someone point me to example code or tutorial on how to do this?
It looks like that is a SOAP message from the Outbound Messaging feature in Salesforce. Instead of treating it as just XML, try using the native PHP SoapServer with the WSDL provided in Salesforce, as it is designed to handle SOAP messages like this. You can get the WSDL at Setup | Create | Workflow & Approvals | Outbound Messages | | Endpoint WSDL. You might also want to look at the Salesforce PHP Client, which uses the corresponding PHP SoapClient and has a utility for handling the sf: namespace and converting to a SObject object. It shouldn't be too hard to rewire the toolkit to act as a server instead of a client so you can handle the Outbound Messages.
PHP's SimpleXML will not work for reading namespace information. See this - http://www.w3schools.com/php/php_xml_simplexml.asp . Instead try something like this http://www.php.net/manual/en/function.xml-parser-create-ns.php
PHP's SimpleXML may work for the case. Just need to use children() and use the right syntax.
Therefore, to read the field value BillingCity in Salesforce Outbound Message, you may use following code:
$rcXML->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children('http://soap.sforce.com/2005/09/outbound')->notifications->Notification->sObject->children('urn:sobject.enterprise.soap.sforce.com')->BillingCity
To help you understand how it works, I write a post with sames code and xml which shall be easier to understand.
http://amigotechnotes.wordpress.com/2013/11/16/parse-xml-with-namespace-by-simplexml-in-php/
Once you may read the filed value, you may store it to other database or text file with PHP.