SoapServer header magic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
I can't seem to figure out how to send a SOAP header to the client without having received the same. The only reference to headers at all that I could find was in the SOAP extension tests directory.

I am trying to implement SimpleSessionHandler (Apache Axis) compatible sessions, but am failing to understand how to send a SOAP header to the client without having first received a header by same name.

In other words, if I send the server a sessionId element with my request, I get a response back (determined by the sessionId method); but if I don't give it a sessionId element, the method isn't called and I get no response.

Is this by design, or is there something that I have overlooked? If it's the former, is it by design of SOAP or a flaw in PHP's implementation?

Thanks,
Harlan

-- Client Call --
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope";
              xmlns:xsd="http://www.w3.org/2001/XMLSchema";
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
              xmlns:enc="http://www.w3.org/2003/05/soap-encoding";
              xmlns:axis-session="http://xml.apache.org/axis/session";>
  <env:Header>
    <!-- if this is present, I get a sessionId back from the server...
          if not, I don't -->
    <axis-session:sessionId
      env:mustUnderstand="true">clientSessionId</axis-session:sessionId>

  </env:Header>
  <env:Body>
    <test:echoString xmlns:test="http://example.org/ts-tests";
          env:encodingStyle="http://www.w3.org/2003/05/soap-encoding";>
      <test:inputString xsi:type="xsd:string">ouch</test:inputString>
    </test:echoString>
  </env:Body>
</env:Envelope>


-- Server Class --
class Soap12test {
	public $sessionId;

	function echoString($inputString) {
		return $inputString . "[ ".$this->sessionId." ]";
	}
	
	function sessionId( $id ) {
		$this->sessionId = $id;
		return "from server - $id";
	}
}


-- WSDL --
<definitions name="SOAP-12-TestDefinitions"
	...
	xmlns:axis-session="http://xml.apache.org/axis/session";>
....
<schema xmlns="http://www.w3.org/2001/XMLSchema";
	targetNamespace="http://xml.apache.org/axis/session";>
	<element name="sessionId" type="xsd:string"/>
</schema>
....
<message name="sessionIdRequest">
	<part name="sessionId" element="axis-session:sessionId"/>
</message>
<message name="sessionIdResponse">
	<part name="sessionId" element="axis-session:sessionId"/>
</message>
....
<operation name="echoString">
	<soap12:operation/>
	<input>
<soap12:body use="encoded" namespace="http://example.org/ts-tests"; encodingStyle="http://www.w3.org/2003/05/soap-encoding"/> <soap12:header message="tns:sessionIdRequest" part="sessionId" use="encoded" encodingStyle="http://www.w3.org/2003/05/soap-encoding"/>
	
	</input>
	<output>
<soap12:body use="encoded" namespace="http://example.org/ts-tests"; encodingStyle="http://www.w3.org/2003/05/soap-encoding"/> <soap12:header message="tns:sessionIdResponse" part="sessionId" use="encoded" encodingStyle="http://www.w3.org/2003/05/soap-encoding"/>
	</output>
</operation>

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux