By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,266 Members | 1,816 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,266 IT Pros & Developers. It's quick & easy.

PEAR::SOAP help me!

P: n/a
Dear all,
is the first time that I use SOAP, and i must say that i'm having
several problems.
this is SOAP message that expects the server
=================XML EXPECTED FROM THE SERVER================
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Header>
<wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
SOAP-ENV:mustUnderstand="1">

<wsse:UsernameToken>

<wsse:Username>isp</wsse:Username>

<wsse:Password>password</wsse:Password>

<wsu:Created
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2005-05-16T07:00:03Z</wsu:Created>

</wsse:UsernameToken>

</wsse:Security>

</SOAP-ENV:Header>

<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

<q1:getEcho xmlns:q1="http://echo.help.webservices.xxxxx.xxxx.com" />

</soap:Body>

</SOAP-ENV:Envelope>

================================================== ========

============== XML SENT FROM MY PROGRAM ==================

<?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns4="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"

SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

<SOAP-ENV:Header>

<Security SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next"
SOAP-ENV:mustUnderstand="1">

<ns4:wsse:UsernameToken>

<Username xsi:type="xsd:string">allaxia-ws</Username>

<Password
xsi:type="xsd:string">6gVTJFjW1MoerWp</Password></ns4:wsse:UsernameToken></Security>

</SOAP-ENV:Header>

<SOAP-ENV:Body>

<getEcho xsi:nil="true"/>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

================================================== =================

After several vicissitudes, i was able to set up the security header and
the mustUnderstand, but now i have always the same error, the server “
does not recognize” the tag ns4.

I have not created the ns4 tag!

====================== ERROR MESSAGE ================
[error_message_prefix] =>

[mode] => 1

[level] => 1024

[code] => Parser

[message] => XML error on line 1 col 1 byte 0 Empty document

[userinfo] => HTTP/1.1 500 Internal Server Error

Date: Tue, 23 May 2006 13:21:45 GMT

Server: Apache/2.0.54 (Win32) mod_ssl/2.0.54 OpenSSL/0.9.8 mod_jk/1.2.10

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode> soapenv:Server.generalException</faultcode><faultstring>WSDoAllReceiver:
cannot convert into document; nested exception is:
org.xml.sax.SAXParseException: Element type &quot;ns4:wsse&quot; must be
followed by either attribute specifications, &quot;&gt;&quot; or
&quot;/&gt;&quot;.</faultstring><detail><ns1:hostname
xmlns:ns1="http://xml.apache.org/axis/">FSSP085</ns1:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>

==================== MY SCRIPTS ========================================
require_once('SOAP/Client.php');

/* Create a new SOAP client using PEAR::SOAP's SOAP_Client-class: */
$client = new
SOAP_Client('https://xxxxxx.xx.xxxxx.com/services/Echo',false,443);
$client->setOpt('curl', CURLOPT_VERBOSE, 1);
$client->setOpt('curl', CURLOPT_SSL_VERIFYPEER, 0);
$client->setOpt('curl', CURLOPT_SSL_VERIFYHOST, 1);
$client->setOpt('curl',CURLOPT_PROXY, '10.0.4.90:8080');
$client->setOpt('curl',CURLOPT_PROXYUSERPWD, 'xxxx.xxxxx:sdhksdjfs');

//new
SOAP_Header('wsse:UsernameToken',array('username'= >'isp','password'=>'password'));

$soapheader = new SOAP_Header("wsse:Security", "object",
array("wsse:UsernameToken" =>
new
Soap_Value("{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}wsse:UsernameToken",
"object",
array( "Username" => new Soap_Value("wsse:Username", "string", "isp"),
"Password" => new Soap_Value("wsse:Password", "string", "password")))),1);
$client->addHeader($soapheader);
$method = 'getEcho';
$params = array();
$namespace="http://echo.help.webservices.xxxxx.xxxxxx.com";
$response = $client->call($method);
print_r($response);
print("###################".$client->getEcho());
thanks for the Help, and excuse me for my bad english

Info
May 24 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.