I have deployed a SOAP WS with AXIS. I use SOAPClient library and PHP 5.5.9 on Ubuntu 14.04 to call the exposed operations, but when I make the "__SoapCall" it returns nothing. I have also tried with "NuSOAP" library, but I obtain the same result.
But when I call "__getLastResponse", It returns the good response (although duplicated), as you can see:
<?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>
<idXMLReturn xmlns="http://aemetproyecto">PD94bWwgdm...</idXMLReturn>
</soapenv:Body>
</soapenv:Envelope>
<?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>
<idXMLReturn xmlns="http://aemetproyecto">PD94bWwgdm...</idXMLReturn>
</soapenv:Body>
</soapenv:Envelope>
Here is the WSDL
My PHP code:
<?php
function generarTabla($id, $formato){
try{
// Create the SoapClient instance
$url = "http://localhost:8080/axis/services/AemetProyect?wsdl";
$client = new SoapClient($url, array("trace" => 1, "exception" => 1));
// Creo XML
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$xml .= "<!DOCTYPE id [\n";
$xml .= "<!ELEMENT id (#PCDATA)>\n";
$xml .= "]>\n";
$xml .= "<id>".$id."</id>";
// Codifico XML en Base64
$Base64xml = base64_encode($xml);
// Llamada SOAP a DescargarInfoTiempo
$resultado = $client -> __soapCall("DescargarInfoTiempo",
array($Base64xml));
//$resultado = $client -> __getLastResponse();
//echo $resultado;
//$resultado = $client -> __getLastRequest();
//echo $resultado;
echo $resultado;
} catch (SoapFault $ex){
$error = "SOAP Fault: (faultcode: {$ex->faultcode}\n"
."faultstring: {$ex->faultstring})";
echo $error;
} catch (Exception $e){
$error = "Exception: {$e->faultstring}";
echo $error;
}
}
?>
I've noticed that the name of return element ("idXMLReturn") is not the same that the name described in WSDL ("DescargarInfoTiempoReturn").
Can this be the problem?
Update
I've tried to do:
$argumens['idXML'] = $Base64xml;
$resultado = $client -> __soapCall("DescargarInfoTiempo",
array($arguments));
and
$arguments['idXML'] = $Base64xml;
$resultado = $client ->DescargarInfoTiempo($arguments);
But then I get "Notice: Array to string conversion" when I do the call.
Your error is in a little detail.
For a call using the SoapClient, you must send the arguments in a array of arguments, instead to send a xml (why you need to do a codification base64? Is some rule of your WebService?). See the PHP docs for get the right way
arguments
An array of the arguments to pass to the function. This can be either an ordered or an associative array. Note that most SOAP servers require parameter names to be provided, in which case this must be an associative array.
So, your array arguments* must to be something like this:
$arguments['id'] = $id// if you need base 64, use base64_encode($id) or something
$resultado = $client -> __soapCall("DescargarInfoTiempo",array($arguments));
Other option to do the same thing, is call the function directly:
$arguments['id'] = $id// if you need base 64, use base64_encode($id) or something
$resultado = $client ->DescargarInfoTiempo($arguments);// note that we don't need array($arguments), just $arguments
See other examples in the comments on the doc page.
Finally, if you still want to create your XML to send, I advise you to do it with other methos like file_get_contents or CURL and don't forget to create your XML with a soap envelop, is needed for the Soap Protocol
*Some old WebServices needs a array with name "parameters"
UPDATE
Look, you're trying to send your $arguments in a array that contains only one element: The XML in your $Base64xml var. I think that The problem still here.
According to PHP manual, you can't send XML in your SoapCall. The var must be a associative array with your vars, so try to do something like this:
$arguments['id'] = $id// this $id var is your function argument(int, string or somenthing else), forget the created XML
$resultado = $client -> __soapCall("DescargarInfoTiempo",array($arguments));
About the base64 that you need, I never needed it before, but see the marcovtwout comment in this page of PHP manual
If your WSDL file containts a parameter with a base64Binary type, you should not use base64_encode() when passing along your soap vars. When doing the request, the SOAP library automatically base64 encodes your data, so otherwise you'll be encoding it twice.
So, I belive that you don't need to encode your vars.
In short, forget the XML and send only your vars. The PHP SoapClient create the Soap envelop with the corrected encodes and all these things.
If you still with problems doing this, try to enclose your var with some SoapVars. Maybe your WSDL configuration needs this treatment.
I hope this helps
The solution is to specify the document literal style as it is explained in
Creating a SOAP call using PHP with an XML body
As I said above, "I've noticed that the name of return element ("idXMLReturn") is not the same that the name described in WSDL ("DescargarInfoTiempoReturn")"
So, that's the problem: AXIS doesn't generate a Envelope that fits to the WSDL schema. It seems java:RPC provider doesn't worry about the return names of operations.
For now, I've solved it by renaming the parameter from "idXML" to "DescargarInfoTiempo", so SOAP response will be "DescargarInfoTiempoReturn" and it will fit with the WSDL schema and PHP will map the response correctly.
Related
I am trying to parse this XML (http://numismatics.org/search/apis/getNuds?identifiers=1995.11.282) and pull out the elements under but when I call SimpleXMLElement I get: "Exception: String could not be parsed as XML" (the API is from http://numismatics.org/search/apis)
Here is what the XML basically looks like from the link above:
<nuds xmlns="http://nomisma.org/nuds" xmlns:mets="http://www.loc.gov/METS/" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nomisma.org/nuds http://nomisma.org/nuds.xsd" recordType="physical">
...deleted to shorten question
<digRep>
<mets:fileSec>
<mets:fileGrp USE="obverse">
<mets:file USE="iiif">
<mets:FLocat LOCYPE="URL" xlink:href="http://images.numismatics.org/collectionimages%2F19501999%2F1995%2F1995.11.282.obv.noscale.jpg"/>
</mets:file>
...deleted to shorten question
</mets:fileGrp>
</mets:fileSec>
</digRep>
</nuds>
Here is the test code I'm using from this example
$detail = simplexml_load_file("http://numismatics.org/search/apis/getNuds?identifiers=1995.11.282");
$digRep = new \SimpleXMLElement($detail->nuds->digRep); //the slash before the SimpleXMLElement is required for Laravel
$digRep->registerXPathNamespace('c', 'http://www.loc.gov/METS');
$result = $digRep->xpath('//c:mets:fileSec');
foreach ($result as $title) {
echo $title . "\n";
}
I am wondering if this has to do with "mets:fileSec" but I am not quite sure what "fileSec" is in this context.
mets is just the alias for the namespace http://www.loc.gov/METS/ (the xmlns:mets definition). This is perfectly fine XML and it parses in the browser if called directly. I suggest checking if you really can get the XML with PHP (with file_get_contents()) and not some error message. Services return sometimes different result for different user agents.
I've been trying to get data from a SOAP service using PHP SoapClient.
If I point to http://my-service?WSDL (obviously I can't expose the correct one) away from PHP on a well know tool called SOAP UI with the right parameters I get a proper response. But In PHP I always get NULL in my response even with the right params and stuff.
This is my code:
<?php
$client = new SoapClient('http://my-service?WSDL',
array('trace'=>true, 'exceptions'=>true));
$params= ['EBMHeader'=> ['EBMID'=> 'anyvalue'],
'DataArea'=> ['Ip'=> '127.0.0.1', 'RequestId'=> '12345']];
try {
$response= $client->MySoapFunction($params);
var_dump($response); // returns always NULL
echo $client->__getLastResponse(); //Returns a valid XML with the proper data
} catch (Exception $exception) {
echo $exception;
}
I already tried these:
Double checked the wsdl and parameters
Changed soap options: trace and exceptions
Changed params keys to see if it fails, it does and SOAP server responds that the param is misssing or whatever the error is, for instance I can say that I'm getting a response from SOAP server.
Tried to debug using __getLastResponse(), it shows a valid XML with the expected data, also I validated the XML to see if it's ok.
Tried to use $client->__soapCall('MySoapFunction', $params, null);
and the result is the same.
I also tried to use the __getLastResponse() output and parse it to var so them i could convert it to an array but the result is an empty object:
$xml= $client->__getLastResponse();
$response = simplexml_load_string($xml, "SimpleXMLElement", LIBXML_NOCDATA);
This is my XML request from PHP with $client->__getLastRequest():
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/" xmlns:ns2="http://url.com/EnterpriseObjects/Autogestion/Producto/ABM/V1/">
<SOAP-ENV:Body>
<ns2:ConsultarProductoABM>
<ns1:EBMHeader>
<ns1:EBMID>whatever</ns1:EBMID>
</ns1:EBMHeader>
<ns2:DataArea>
<ns2:Ip>127.0.0.1</ns2:Ip>
<ns2:RequestId>12345</ns2:RequestId>
</ns2:DataArea>
</ns2:ConsultarProductoABM>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
And this is my response $client->__getLastResponse():
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Body xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<v1:ConsultarProductoResponseEBM xmlns:v1="http://url.com/EnterpriseObjects/Core/EBM/Producto/V1/">
<v11:EBMHeader xmlns:v11="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/">
<v11:EBMID>anything</v11:EBMID>
<v11:CreationDateTime>2015-10-16T19:09:54.962-03:00</v11:CreationDateTime>
<v11:Sender>ATG</v11:Sender>
<v11:Target>SMFLX</v11:Target>
<v11:BusinessScope>SIN_CONFIGURACION</v11:BusinessScope>
<v11:BusinessScope>SIN_CONFIGURACION</v11:BusinessScope>
<v11:BusinessScope>SIN_CONFIGURACION</v11:BusinessScope>
<v11:BusinessScope>e6e00a83-ce05-4e2a-bdb6-d7bfbd14d84a</v11:BusinessScope>
<v11:EBMTracking>ConsultarProductoAutogestionReqABCS (V1).ConsultarProducto_+++_ConsultarProductoProvisioningProvABCS (V1).ConsultarProducto_+++_ValidarRespuestaEBS (V1).ValidarRespuesta_+++_ConsultarProductoOpenSmartFlexProvABCS (V1).ConsultarProducto_+++_ValidarRespuestaEBS (V1).ValidarRespuesta</v11:EBMTracking>
<v11:FaultNotification>
<ns1:FaultMessage xmlns:ns2="http://url.com/EnterpriseObjects/Autogestion/Producto/ABM/V1/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"/>
<ns1:FaultingService xmlns:ns2="http://url.com/EnterpriseObjects/Autogestion/Producto/ABM/V1/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"/>
<ns1:Destination xmlns:ns2="http://url.com/EnterpriseObjects/Autogestion/Producto/ABM/V1/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"/>
</v11:FaultNotification>
</v11:EBMHeader>
<v11:ReturnCode xmlns:v11="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/">0</v11:ReturnCode>
<v11:ReturnMessage xmlns:v11="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/"/>
<v11:ErrorCode xmlns:v11="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/">0</v11:ErrorCode>
<v1:DataArea>
<v1:InstalledProduct>
<v11:Hub xmlns:v11="http://url.com/EnterpriseObjects/Core/EBO/InstalledProduct/V1/">BON</v11:Hub>
<v11:Node xmlns:v11="http://url.com/EnterpriseObjects/Core/EBO/InstalledProduct/V1/">BON076A</v11:Node>
<v11:CustomerParty xmlns:v11="http://url.com/EnterpriseObjects/Core/EBO/InstalledProduct/V1/">
<v12:Id xmlns:v12="http://url.com/EnterpriseObjects/Core/EBO/CustomerParty/V1/">7889679</v12:Id>
<v12:PartyHuman xmlns:v12="http://url.com/EnterpriseObjects/Core/EBO/CustomerParty/V1/">
<v13:FirstName xmlns:v13="http://url.com/EnterpriseObjects/Core/EBO/Common/V1/">JOHN</v13:FirstName>
<v13:LastName xmlns:v13="http://url.com/EnterpriseObjects/Core/EBO/Common/V1/">DOE</v13:LastName>
</v12:PartyHuman>
<v12:Location xmlns:v12="http://url.com/EnterpriseObjects/Core/EBO/CustomerParty/V1/">
<v13:Address xmlns:v13="http://url.com/EnterpriseObjects/Core/EBO/Common/V1/">
<v13:ProvinceName>LACATION</v13:ProvinceName>
<v13:StateName>LACATION</v13:StateName>
<v13:CityName>LACATION</v13:CityName>
</v13:Address>
</v12:Location>
</v11:CustomerParty>
<v11:ContractID xmlns:v11="http://url.com/EnterpriseObjects/Core/EBO/InstalledProduct/V1/">123456</v11:ContractID>
<v11:Service xmlns:v11="http://url.com/EnterpriseObjects/Core/EBO/InstalledProduct/V1/">
<v11:ClassId>52</v11:ClassId>
</v11:Service>
</v1:InstalledProduct>
</v1:DataArea>
</v1:ConsultarProductoResponseEBM>
</soap-env:Body>
</soapenv:Envelope>
The problem is that i don't know what else to do to get a valid php response if i do:
$response= $client->MySoapFunction($params);
var_dump($response);
I create an XML document using PHP's XMLWriter.
$xmlWriter = new \XMLWriter();
$xmlWriter->openMemory(); //generate XML in-memory, not on disk
//Please keep the indentation intact to preserve everybody's sanity!
$xmlWriter->startElement('RootElement');
// ...
$xmlWriter->endElement();
$myXml = $xmlWriter->outputMemory(true);
Now I connect to a SOAP service in non-WSDL mode.
$soapClient = new \SoapClient(null, array(
"location" => "https://theservice.com:1234/soap/",
"uri" => "http://www.namespace.com",
"trace" => 1
)
);
$params = array(
new \SoapParam($myXml, 'param')
);
$result = $soapClient->__soapCall('method', $params);
The problem is that the SOAP message received by the SOAP service contains my data as escaped XML characters. (Warning : dummy SOAP message ahead!)
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope" ...>
<SOAP-ENV:Header>
...
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:method>
<Request xsi:type="xsd:string">
<Root>
(escaped data)
</Root>
</Request>
</ns1:method>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The SOAP service will not work with escaped data but, on the other hand, I don't escape my data, the SoapClient does so. How do I make my SoapClient send unescaped data?
Escaping characters is the expected behavior of the XmlWriter::writeElement method.
It took me a while to figure it out but the answer was simple : put a SoapVar with the XSD_ANYXML parameter into the SoapParam :
$params = array(
new \SoapParam(new \SoapVar($myXml, XSD_ANYXML), 'param')
);
The SoapVar documentation mentions that its second parameter (encoding) can be "one of the XSD_... constants" which are not documented in the PHP docs.
I have created a soap client in PHP that signs on, but for the second request I want to make I cannot seem to get the PHP to structure the request properly.
This is request that works in SoapUI
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://v1.productapi.gs1ca.org" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<v1:searchProducts>
<sessionId>f53c5450-392e-4ca4-b592-adbb436cfe1f</sessionId>
<searchCriteria>
<v1:AttributeValue>
<v1:attribute>dateupdated</v1:attribute>
<v1:value i:type="b:string" xmlns:b="http://www.w3.org/2001/XMLSchema">08/01/2013</v1:value>
</v1:AttributeValue>
<v1:AttributeValue>
<v1:attribute>dateupdatedcompare</v1:attribute>
<v1:value i:type="b:string" xmlns:b="http://www.w3.org/2001/XMLSchema">1</v1:value>
</v1:AttributeValue>
</searchCriteria>
<includeImageAttributes>0</includeImageAttributes>
<sortOrder>dateupdated</sortOrder>
</v1:searchProducts>
</soapenv:Body>
</soapenv:Envelope>
How would I use PHP to format the XML the same way as the working request?
Some progress has been made.
I have been able to recreate the xml up to a point now. The request looks like this:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://v1.productapi.gs1ca.org">
<SOAP-ENV:Body>
<ns1:searchProducts>
<sessionId>2a7d0294-8d96-428d-abd8-08add9cfc427</sessionId>
<searchCriteria>
<ns1:AttributeValue>
<ns1:attribute>dateupdated</ns1:attribute>
<ns1:value>01/01/2013</ns1:value>
</ns1:AttributeValue>
<ns1:AttributeValue>
<ns1:attribute>dateupdatedcompare</ns1:attribute>
<ns1:value>1</ns1:value>
</ns1:AttributeValue>
</searchCriteria>
<includeImageAttributes>false</includeImageAttributes>
<sortOrder>dateupdated</sortOrder>
</ns1:searchProducts>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The PHP creating that request is:
$args0 = array(
'sessionid'=>$session,
'searchcriteria'=> array(array('attribute'=>'dateupdated','value'=>'01/01/2013'),array('attribute'=>'dateupdatedcompare','value'=>'1')),
'includeimageattributes'=>0,
'sortorder'=>'dateupdated');
$result = $client->__soapCall('searchProducts',$args0);
The error this throws is:
Error: SoapFault exception: [a:DeserializationFailed] The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://v1.productapi.gs1ca.org:searchCriteria. The InnerException message was 'Element value from namespace http://v1.productapi.gs1ca.org cannot have child contents to be deserialized as an object. Please use XmlNode[] to deserialize this pattern of XML.
I am still missing a portion of the envelope:
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
And I need the value tags to look like this:
<v1:value i:type="b:string" xmlns:b="http://www.w3.org/2001/XMLSchema">
Any ideas on how I can add those portions in?
Okay! I Finally figured this out. It is ugly but it works.
try {
$args = array(
'sessionid'=>$session,
'searchcriteria'=> new SoapVar('<searchCriteria><ns1:AttributeValue>
<ns1:attribute>dateupdated</ns1:attribute>
<ns1:value xsi:type="b:string" xmlns:b="http://www.w3.org/2001/XMLSchema">01/01/2013</ns1:value>
</ns1:AttributeValue>
<ns1:AttributeValue>
<ns1:attribute>dateupdatedcompare</ns1:attribute>
<ns1:value xsi:type="b:string" xmlns:b="http://www.w3.org/2001/XMLSchema">1</ns1:value>
</ns1:AttributeValue></searchCriteria>
', XSD_ANYXML, "http://www.w3.org/2001/XMLSchema-instance"),
'includeimageattributes'=>0,
'sortorder'=>'dateupdated');
$result = $client->__soapCall('searchProducts',$args);
} catch (SoapFault $e) {
echo "Error: {$e}";
}
I'm trying to access a WebService using nuSOAP (because I'm bound to PHP4 here) that uses more than 1 namespace in a message. Is that possible?
An example request message would look like this:
<soapenv:Envelope ...
xmlns:ns1="http://domain.tld/namespace1"
xmlns:ns2="http://domain.tld/namespace2">
<soapenv:Header/>
<soapenv:Body>
<ns1:myOperation>
<ns2:Person>
<ns2:Firstname>..</ns2:Firstname>
..
</ns2:Person>
<ns1:Attribute>..</ns1:Attribute>
</ns1:myOperation>
</soapenv:Body>
</soapenv:Envelope>
I tried to following:
$client = new nusoap_client("my.wsdl", true);
$params = array(
'Person' => array(
'FirstName' => 'Thomas',
..
),
'Attribute' => 'foo'
);
$result = $client->call('myOperation', $params, '', 'soapAction');
in the hope that nuSOAP would try to match these names to the correct namespaces and nodes. Then I tried to use soapval() to generate the elements and their namespace - but if I call an operation, nuSOAP creates the following request:
<SOAP-ENV:Envelope ...>
<SOAP-ENV:Body>
<queryCCApplicationDataRequest xmlns="http://domain.tld/namespace1"/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
So something goes wrong during the "matching" phase.
After trying around with the matching, I found two possible solutions:
1) Don't use the WSDL to create the nusoap_client and soapval() to create the message
This has the disadvantage that the message contains a lot of overhead (the namespace is defined in each element). Not so fine.
2) Instead of relying on the matching of parameters, construct your reply in xml and put all the definition for prefixes in the first element - e.g.
$params = "<ns1:myOperation xmlns:ns1="..." xmlns:ns2="...">
<ns2:Person>
<ns2:Firstname>..</ns2:Firstname>
..
</ns2:Person>
<ns1:Attribute>..</ns1:Attribute>
</ns1:myOperation>";
Still not a very nice solution, but it works :-)
Building on Irwin's post, I created the xml manually and had nusoap do the rest. My webhost does not have the php soap extension, so I had to go with nusoap, and the web service I'm trying to consume required the namespaces on each tag (e.g. on username and password in my example here).
require_once('lib/nusoap.php');
$client = new nusoap_client('https://service.somesite.com/ClientService.asmx');
$client->soap_defencoding = 'utf-8';
$client->useHTTPPersistentConnection(); // Uses http 1.1 instead of 1.0
$soapaction = "https://service.somesite.com/GetFoods";
$request_xml = '<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<n1:GetFoods xmlns:n1="https://service.somesite.com">
<n1:username>banjer</n1:username>
<n1:password>theleftorium</n1:password>
</n1:GetFoods>
</env:Body>
</env:Envelope>
';
$response = $client->send($request_xml, $soapaction, '');
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
Then I had an error that said:
Notice: Undefined property: nusoap_client::$operation in ./lib/nusoap.php on line 7674
So I went the lazy route and went into nusoap.php and added this code before line 7674 to make it happy:
if(empty($this->operation)) {
$this->operation = "";
}
Another bypass this issue would be a modification to nusoap_client::call() function. Next to the this line (7359 in version 1.123) in nusoap.php:
$nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace);
I added this one:
$nsPrefix = $this->wsdl->getPrefixFromNamespace("other_ns_name");
And it worked! Since I only needed this library for one project, it was OK for me to hardcode this hack. Otherwise, I would dig more and modify the function to accept array instead of string for a namespace parameter.
Yeah, i've been having this same problem (found your q via google!) and i've come across this:
http://www.heidisoft.com/blog/using-nusoap-consume-net-web-service-10-min
Here, the dev creates the xml body of the message in coe and then uses nusoap to submit.