Jump to content

SOAP Problems (witout using WSDL) Help Desperately Needed!


FollowTheCode

Recommended Posts

I am doing a project at the minute, requiring me to communicate with a (poorly documented) custom designed server (with 1000's of lines of code in it).  It doesn't make use of WSDL  - however I believe the structure of the SOAP XML Data to be as follows:

 

<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope'>
<SOAP-ENV:Header>
<amsh:username xmlns:amsh='http://ams/header' SOAP-ENV:actor='http://ams/server'>
alex
</amsh:username>
<amsh:password xmlns:amsh='http://ams/header' SOAP-ENV:actor='http://ams/server'>
WIDhBCudeHOI5h0xj8h+J+AVEw0=
</amsh:password>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<EncryptedData>
DiIvrc32LaAYfv9IyG2GuC8/kMq/QTOneS373G4Ubow5g8dlSWcnz0GV5M2
nR3zmKLsl0AFmn2Vy+0DOIEoMLyuaQoi9hOuiBayvxhQaD9NU+35Y15gKjK
yu7IvWyNoyJIxgp69PciMvuAnCAeDnMsol4L/fMyoxBLTTc32VoZ1veKrgm
gj5ew==
</EncryptedData>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

I am having difficulty constructing a script that creates the above packet.  Forgive me if there any obvious errors, but I am new to PHP, new to SOAP, new to XML, stuck with a server with no documentation and feeling pretty much dumped in at the deep end.

 

I have chosen to use PHP's SOAP extension to do this with, and so far have the following code:

 

<?php 

$server = "http://localhost:8084/AMS-WebModule/AccessServlet";

$SOAPClient = new SoapClient(NULL, array(	"location" 	=> $server,
										"uri"		=> "xmlns:amsh",
										"style"		=> SOAP_RPC,
										"use"		=> SOAP_ENCODED
									));

$auth["username"]="alex";
$auth["hashedpassword"]="WIDhBCudeHOI5h0xj8h+J+AVEw0=";

$SOAPHeader=new SoapHeader('http://ams/header','amsh',$auth); 
$SOAPClient->__setSoapHeaders(array($SOAPHeader)); 

var_dump($SOAPClient);

$XMLPacket ="<EncryptedData>
DiIvrc32LaAYfv9IyG2GuC8/kMq/QTOneS373G4Ubow5g8dlSWcnz0GV5M2
nR3zmKLsl0AFmn2Vy+0DOIEoMLyuaQoi9hOuiBayvxhQaD9NU+35Y15gKjK
yu7IvWyNoyJIxgp69PciMvuAnCAeDnMsol4L/fMyoxBLTTc32VoZ1veKrgm
gj5ew==
</EncryptedData>";

$ReturnedSOAPXMLPacket = $SOAPClient->doRequest($XMLPacket, $server, "", "1.0");

var_dump($ReturnedSOAPXMLPacket);
?>

 

However this results in the following error:

 

Fatal error: Uncaught SoapFault exception: [sOAP-ENV:Client] No Header in C:\WebServer\WebRoot\Projects\ams\index.php:28 Stack trace: #0 [internal function]: SoapClient->__call('doRequest', Array) #1 C:\WebServer\WebRoot\Projects\ams\index.php(28): SoapClient->doRequest('<EncryptedData>...', 'http://localhos...', '', '1.0') #2 {main} thrown in C:\WebServer\WebRoot\Projects\ams\index.php on line 28

 

Any fixes or alternatives are desperately sought in addition anyone who can answer the following q's will be the recipient of much gratitude - I am getting desperate.

Where the XML Namespace is designated as "xmlns:amsh='http://ams/header'" (where ams is the server name) should I be able to view anything at that address (because I can't)?

 

Should there be a Namespace for the <EncryptedData> Tag?

Many Thanks in Advance

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.