I get an error message:
System.Web.Services.Protocols.SoapException: The server could not process the request. ---> System.ArgumentNullException
When I try to call my web service using the following code:
{
ServiceNameType sourceService = new ServiceNameType {Service = "echoSync", OnBehalfOf = "Source"};
ServiceNameType destService = new ServiceNameType {Service = "echoSync", OnBehalfOf = "Destination"};
SDD2RequestType request = new SDD2RequestType
{
AppId = "echoSync",
SourceService = sourceService,
DestService = destService,
RequestId = "1",
RequestBody = "Ping"
};
originator originator = new originator {id = "123456789"};
SDD2Transport transport = new SDD2Transport {originatorValue = originator};
SDD2ResponseType response = null;
response = transport.SDD2TransportOp(request);
System.Console.WriteLine(response.ResponseBody.ToString());
}
My webservice method is pretty simple and looks something like this:
[System.Web.Services.Protocols.SoapHeaderAttribute("originatorValue", Direction = System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
[System.Web.Services.WebMethodAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://memberdirect.net/SDD2/Transport", RequestElementName = "SDD2Transport", RequestNamespace = "http://cucbc.com/sdd2/transport/", ResponseElementName = "SDD2TransportResponse", ResponseNamespace = "http://cucbc.com/sdd2/transport/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Default)]
[return: System.Xml.Serialization.XmlElementAttribute("SDD2Response", Namespace = "http://cucbc.com/sdd2/")]
public override SDD2ResponseType SDD2TransportOp(SDD2RequestType SDD2Request)
{
if (SDD2Request == null) throw new ArgumentNullException("SDD2Request");
var response = new SDD2ResponseType();
switch (SDD2Request.AppId)
{
case "echoSync":
response.AppId = SDD2Request.AppId;
response.ProcessingStatus = ProcessingStatusType.Complete;
response.RequestId = SDD2Request.RequestId;
response.ResponseBody = "Pong";
break;
default:
throw new System.NotImplementedException();
break;
}
return response;
}
When I make a call, I know that the request is not NULL, but when it arrives at the web service, it is always accepted as null. I created the webservice from WSDL using the wsdl.exe utility and obviously do not understand all the details of SOAP that I have to. Anyone else run into this issue?
Daver source
share