私の会社内でリモートWebサービスを呼び出そうとしています。独自の理由から、私はWebサービスにURLを提供できません。 Webサービスには、getItemFieldという単一の関数があります。それは次のようにサービスの説明があり、私は反対PHPを実行しようとしている小規模なテストサービスである:PHPとSoapアクションヘッダなし
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://www.oracle.com/ws/MyFirstWebService" xmlns:intf="http://www.oracle.com/ws/MyFirstWebService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://www.w3.org/1999/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.oracle.com/ws/MyFirstWebService">
<!--
WSDL created by Apache Axis version: 1.2alpha Built on Oct 23, 2007 (12:09:54 IST)
-->
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.oracle.com/ws/MyFirstWebService">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOf_xsd_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</wsdl:types>
<message name="getItemFieldRequest">
<part name="args" type="impl:ArrayOf_xsd_string"/>
</message>
<message name="getItemFieldResponse">
<part name="getItemFieldReturn" type="soapenc:string"/>
</message>
<portType name="MyFirstWebService">
<operation name="getItemField" parameterOrder="args">
<input message="impl:getItemFieldRequest" name="getItemFieldRequest"/>
<output message="impl:getItemFieldResponse" name="getItemFieldResponse"/>
</operation>
</portType>
<binding name="MyFirstWebServiceSoapBinding" type="impl:MyFirstWebService">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getItemField">
<wsdlsoap:operation soapAction=""/>
<input name="getItemFieldRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://first" use="encoded"/>
</input>
<output name="getItemFieldResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.oracle.com/ws/MyFirstWebService" use="encoded"/>
</output>
</operation>
</binding>
<service name="MyFirstWebServiceService">
<port binding="impl:MyFirstWebServiceSoapBinding" name="MyFirstWebService">
<wsdlsoap:address location="http://myWebsite.com/services/MyFirstWebService"/>
</port>
</service>
</definitions>
私はサービスにうまく接続して、単一の機能とタイプの名前をプリントアウトすることができ、しかし、関数を呼び出そうとすると、'SOAPActionヘッダがありません!'というメッセージが表示されます。エラー。次のようにサービス機能を呼び出すために私のPHPコードは次のようになります。定義されたのSOAPActionを持っているように見えないサービスの説明に基づいて
$options = array(
// Dev
'soap_version'=>SOAP_1_2,
'exceptions'=>true,
'trace'=>1,
'cache_wsdl'=>WSDL_CACHE_NONE,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
// Credentials
'login' => 'user',
'password' => 'pass'
);
// Connected successfully
$client = new SoapClient("http://myWebsite.com/services/MyFirstWebService?wsdl", $options);
//Params
$params = array('123456');
//Options
$options = array('soapaction' => '""');
//Call function (Both methods below throw the same 'no SOAPAction header!' error)
//$result = $client->getItemField(new SoapParam($params, "getItemFieldRequest"));
$result = $client->__soapCall("getItemField", array('123456'), $options);
。 soapActionで見られる行は<wsdlsoap:operation soapAction=""/>
です。何も定義されていないので空のsoapActionを指定しようとしましたが、それはうまくいかないようです。 Webサービス定義自体は不完全ですか?または、クライアントサイドのアプリケーション呼び出しでパラメータが不足していますか?前もって感謝します。
UPDATE:
は、SOAPアクションとしてメソッド名を指定しようとしましたが、htatは動作しませんでした。
//Params
$params = array('123456');
//Options
$options = array('soapaction' => 'getItemField');
//Call function (STILL THROWS 'no SOAPAction header!')
$result = $client->__soapCall("getItemField", $params, $options);
私は、それが「」に設定されていますつまりあれば何のsoapActionは、WSDLで指定されていない場合に行うことになっています。
これに関する更新はありますか?私はZend soapを介して接続できるWebサービス上のカールを介して接続しようとしているときに同じ問題に直面しているので、いくつかのオプションやヘッダーに関連していると思います。 –
SOAPActionヘッダーがHTTPヘッダーに関連していませんか? http://www.oreillynet.com/xml/blog/2002/11/unraveling_the_mystery_of_soap.html – pedromanoel