我想从PHP脚本向我的服务器发送SOAP请求。我们的供应商提供的肥皂模板是这样的:从PHP发送SOAP请求
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:q0="http://nsn.com/ossbss/charge.once/wsdl/entity/Tis/xsd/1"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<wsse:Security>
<wsse:UsernameToken>
<wsse:Username>$USER_NAME</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">$USER_PASSWORD</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<q0:CommandRequestData>
<q0:Environment>
<q0:Parameter name="ApplicationDomain" value="CAO_LDM_00" />
<q0:Parameter name="DefaultOperationNamespace" value="GMF" />
</q0:Environment>
<q0:Command>
<q0:Transaction>
<!-- read the Balance of a customer -->
<q0:Operation name="Read" modifier="ROP">
<q0:ParameterList>
<q0:StringParameter name="CustomerId">$NUMBER</q0:StringParameter>
<q0:SymbolicParameter namespace="@" name="SelectionDate">NOW</q0:SymbolicParameter>
</q0:ParameterList>
<q0:OutputSpecification>
<q0:StructParam namespace="GDM" name="Customer">>
<q0:SimpleParam name="CustomerId" />
</q0:StructParam>
<q0:SimpleParam name="OnPeakAccountID_FU" />
</q0:OutputSpecification>
</q0:Operation>
</q0:Transaction>
</q0:Command>
</q0:CommandRequestData>
</soapenv:Body>
</soapenv:Envelope>
这里的用户名和密码都必须在头中发送,$号在体内。并在响应中询问CustomerID和OnPeakAccountID_FU参数。 我想使用curl来执行这个post请求,但不知道如何格式化请求本身。即WDL。
编辑: HTTP请求去我们的内部服务器,如:
http://IP:PORT/TisService
php有一个内置的[soapclient](http://php.net/manual/en/class.soapclient.php)类,可能会更容易。你确定你想用卷发与肥皂api谈谈吗? –
http://nsn.com/ossbss/charge.once/wsdl/entity/Tis/xsd/1 is 404 –
我已阅读一些使用cURL的建议。无论如何,这不是一个问题,我只是想知道如何格式化我的请求,并在头中传递登录细节,并请求回复 – Fshamri