I have a Drupal 6 module that provides a web service using nusoap. I can access the service with php but service can't be accessed from .net application. If I however use the same code to provide web service in Drupal 7 it can be accessed from .net application.
Here is the function providing the web service:
function _provide_nusoap_server(){
// Pull in the NuSOAP code
require_once('lib/nusoap.php');
// Create the server instance
$server = new soap_server();
global $base_url;
// Initialize WSDL support
$server->configureWSDL('mynamespace', 'urn:mynamespace', $base_url.'/mysoap');
// tämä paluuarvoille
$server->wsdl->addComplexType(
'stringArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')
),
'xsd:string'
);
// Register the method
$server->register('mysoap_addModifyProduct', // method name
array(
'salasana' => 'xsd:string',
'rekkariId' => 'xsd:int', // to identify event in rekisteri. Later on id can be used to update or delete certain event
//'op' => 'xsd:string', // op should be 'insert' or 'update'
'tuotenimi' => 'xsd:string',
),
array(
'ret' => 'tns:stringArray',
),
'urn:mynamespace', // namespace
'urn:mynamespace#mysoap_addModifyProduct', // soapaction
'rpc', // style
'encoded', // use
'Adds stuff to Drupal database' // documentation
);
// Use the request to (try to) invoke the service
global $HTTP_RAW_POST_DATA;
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
}
And here is the wsdl-file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions 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:tns="urn:mynamespace" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:mynamespace">
<types>
<xsd:schema targetNamespace="urn:mynamespace"
>
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
<xsd:complexType name="stringArray">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
</types>
<message name="mysoap_addModifyProductRequest">
<part name="salasana" type="xsd:string" />
<part name="rekkariId" type="xsd:int" />
<part name="tuotenimi" type="xsd:string" /></message>
<message name="mysoap_addModifyProductResponse">
<part name="ret" type="tns:stringArray" /></message>
<portType name="mynamespacePortType">
<operation name="mysoap_addModifyProduct">
<documentation>Adds stuff to Drupal database</documentation>
<input message="tns:mysoap_addModifyProductRequest"/>
<output message="tns:mysoap_addModifyProductResponse"/>
</operation>
</portType>
<binding name="mynamespaceBinding" type="tns:mynamespacePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="mysoap_addModifyProduct">
<soap:operation soapAction="urn:mynamespace#mysoap_addModifyProduct" style="rpc"/>
<input><soap:body use="encoded" namespace="urn:mynamespace" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="urn:mynamespace" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
</binding>
<service name="mynamespace">
<port name="mynamespacePort" binding="tns:mynamespaceBinding">
<soap:address location="[the url of the service]/mysoap"/>
</port>
</service>
</definitions>