Link to home
Start Free TrialLog in
Avatar of bradley525
bradley525

asked on

Change Namespace SOAP

Hello I am sending XML using SOAP and I need to change the namespace. Below is the code I am using and the results I am getting and what I need to change it to..Any help would be greatly appreciated.

Thanks


Current Script
<?php 

$client = new SoapClient('http://www.dfwebservice.net/DfcsRemittance.asmx?WSDL', array('soap_version' => SOAP_1_2,				'trace' => 1,
		'use' => SOAP_LITERALL,
        'style' => SOAP_DOCUMENT,
		'encoding'=>' UTF-8'));
		
		$typedVar = new SoapVar("mystring", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema");
$params = '<RemittanceRequest><RequestType>BranchListRequest</RequestType><agent>BWS</agent><userid>wbsuser</userid><password>pass@wbs</password></RemittanceRequest>';	
$params = new SoapVar($params, XSD_ANYXML);
	
$result = $client->GetBranchListXML($params);
echo "REQUEST:\n" . $client->__getLastRequest() . "\n";
echo "Response:\n" . $client->__getLastResponse() . "\n";

print_r($result);

Open in new window


The request comes out as

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://dfwebservice.net/"><env:Body>
<RemittanceRequest>
<RequestType>BranchListRequest</RequestType>
<agent>BWS</agent>
<userid>wbsuser</userid>
<password>pass@wbs</password>
</RemittanceRequest>
</env:Body>
</env:Envelope>

But I need the request to come out as

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
                                <RemittanceRequest>
                                <RequestType>BranchListRequest</RequestType>"
                                <agent>BWS</agent>"
                                 <userid>wbsuser</userid>"
                                <password>pass@wbs</password>
                               </RemittanceRequest>
                                             </soap:Body>
                                                </soap:Envelope>


Thank you for your help!
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bradley525
bradley525

ASKER

Ok do you have experience with nusoap they do not have a restful api
It's got its own web sites.  None of my experiences with SOAP (of any sort) have been good at all.  This is a pretty universal condition.  Most of the major internet players have abandoned SOAP because of all the trouble it causes for developers.  Some links that you may want to explore...
http://sourceforge.net/projects/nusoap/
https://code.google.com/p/nusoap-for-php5/issues/list
http://www.scottnichol.com/nusoapintro.htm
http://www.nusphere.com/php_script/nusoap.htm
http://www.greenacorn-websolutions.com/php/working-with-nusoap.php