PHP and no Soap action header

I am trying to call a remote web service in my company. For private reasons, I cannot provide the web service url. The web service has one function called getItemField. This is a small test service with which I am trying to run PHP, the description of the service is as follows:

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

I can connect to the service just fine and print the name of one function and type, but when I try to call the function, I get "no SOAPAction header!" . My PHP code to call the service function is as follows:

$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. , soapAction, <wsdlsoap:operation soapAction=""/>. soapAction, , , , . - ? - ? .

UPDATE:

, htat .

    //Params
    $params = array( '123456' );

    //Options
    $options = array( 'soapaction' => 'getItemField' );

    //Call function (STILL THROWS 'no SOAPAction header!')
    $result = $client->__soapCall( "getItemField", $params, $options );

, wsdl soapAction, .. "".

+5
2

, cURL, SoapClient, .

, Content-Type. action " ".

$headers = array();
$headers[] = 'Content-Type: application/soap+xml; charset=utf-8; action="[soap action goes here]"';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

, , wsdl :

<wsdl:operation name="getProducts">
    <soap:operation soapAction=""/>
    <!-- trimmed -->
</wsdl:operation>

soapAction="", action="" . . , , operation, action="getProducts".

SoapClient php, SOAP SoapAction, :

$client = new SoapClient( "http://myWebsite.com/services/MyFirstWebService?wsdl", $options );
$result = $client->__soapCall( "getItemField", array('123456') );

- $options, __soapCall(), ( )?

+2

, , :

//Replace accordingly: see PHP Manual
//(http://www.php.net/manual/en/soapheader.soapheader.php)

$header = new SoapHeader($namespace, $name, $data, $mustunderstand, $actor);
$client->__setSoapHeaders($header);

//Main soap call follows....

. , .

-1

All Articles