Hi,
I'm new to SOAP (and relatively new to php). I'm really struggling to get what looks like a very simple web service request to work. I need to send an XML string to a remote .NET service.

I can access the WSDL (I even understand most of it!) but I can't for love nor money get the server to send back anything more encouraging than a 400 or 500 error - using either PHP SOAP or nusoap.

The operation name I need is SubmitCalls. It has only one input message - SubmitCallsSoapIn, the message looks like this:

<wsdl:part name="parameters" element="tns:SubmitCalls"/>

***nusoap attempt generating a 500 (username/password obfuscated)

<?php
require_once('../lib/nusoap.php');

/* Initialize parameter */
$xml = '<SubmitCalls xmlns="http://biomni.com/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<request>
<?xml version="1.0" encoding="UTF-8"?>
<bXML xmlns="http://www.biomni.com/Schemas" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<From>
		<UserName>***</UserName>
		<Password>***</Password>
	</From>
	<Calls>
		<Call>
			<Reference>11111</Reference>
			<Name>Joe Bloggs</Name>
			<Tel1>02075574200</Tel1>
			<Tel2>02075574201</Tel2>
			<Tel3>02075574202</Tel3>
			<Tel4>02075574203</Tel4>
			<Tel5>02075574204</Tel5>
			<CLI>08448220640</CLI>
			<CallTime>09:00</CallTime>
			<FileName>02075574200_1</FileName>
		</Call>
	<Call>
			<Reference>11111</Reference>
			<Name>Joe Bloggs</Name>
			<Tel1>02075574200</Tel1>
			<Tel2>02075574206</Tel2>
			<Tel3>02075574207</Tel3>
			<Tel4>02075574208</Tel4>
			<Tel5>02075574209</Tel5>
			<CLI>08448220640</CLI>
			<CallTime>10:00</CallTime>
			<FileName>02075574200_2</FileName>
		</Call>
	</Calls>
</bXML>
</request>
</SubmitCalls>';


$wsdl = "https://www.biomnivoice.com/BrooksHealthcareWebService/BrooksHealthcareWebService.asmx?WSDL";
$client = new nusoap_client($wsdl, true);
$client->soap_defencoding = 'utf-8';
$client->useHTTPPersistentConnection();
$soapaction = "http://biomni.com/SubmitCalls";


    /* create the proxy object */
   $proxy = $client->getProxy();

$response = $proxy->send($xml,$soapaction);
// Snipped code for displaying request/response and debug_str

Instead of using the proxy object and the send method (trying both in desperation) I can generate a 400 error using the following:

$response = $client->call("SubmitCalls",$xml,"http://www.bionmi.com/", '', false, null, 'document', 'literal');

I've been trying to get this to work for three days - read countless forum posts and web pages. It looks dirt simple, but for whatever reason I just can't get it to work. I've also tried using PHP's compiled in SOAP with the same results (using nusoap because the display on screen is more verbose).

Please, please, please can you point me in the right direction on this one. It's driving me nuts!

    Quite a few people have read my post, but no-one has said anything.

    Anyone got any tips at all on why it's returning a bad request? Does that mean it's something in the headers (if so, when I do a PHP SOAP __dorequest and put the entire soap call exactly as it is apparently required by the .NET WSDL, why does it still error?) or the encoding, or what....

    Seriously, it's driving me nuts as I can't tell whether it's the string I'm sending that's wrong, or something more fundamental with the transport layer.....

      Not exactly an answer to the issue - but it is now solved. The service provider created a new method, which was identical in all respects except that it allowed for an XML document rather than a string. By making some minor alterations to the contents of the $bodyxml variable, and sending to this new method, it appears to work fine.

      By the way - anyone looking to debug SOAP applications should really look at grabbing SOAP UI off Sourceforge. This really helped me sanity check my issue, and provided some useful pointers for the fix.

        8 months later
        Write a Reply...