I'm trying to create custom webservice client for "Disposable Email Address Detector" for my ASP.NET web application written in C#. I added Service Reference to my project and successfully generated proxy class and whole configuration using http://ift.tt/1FcSUcF
Below is the code which I use to query web service:
SoapDisposableEmailAddressDetectorClient service_client = new SoapDisposableEmailAddressDetectorClient();
soapContext context = new soapContext();
context.apiKey = "myapikey";
soapDisposableEmailAddressDetectorResult result = service_client.isDisposable(context, "test@testmail.pl");
Debug.Print("soapDisposableEmailAddressDetectorResult.disposable: {0}", result.disposable);
Unfortunatelly webservice throws HTTP error 400 BAD request.
I decided to test web service using SoapUI, and I also used Fiddler to check what is send to NameAPI webservice from my app.
Below SOAP message generated by SoapUI:
<soapenv:Envelope xmlns:soapenv="http://ift.tt/sVJIaE" xmlns:dis="http://ift.tt/1eA8QQK">
<soapenv:Header/>
<soapenv:Body>
<dis:isDisposable>
<context>
<apiKey>*****</apiKey>
</context>
<emailAddress>test@testmail.pl</emailAddress>
</dis:isDisposable>
</soapenv:Body>
</soapenv:Envelope>
And SOAP message generated by my app:
<s:Envelope xmlns:s="http://ift.tt/sVJIaE">
<s:Body xmlns:xsi="http://ift.tt/ra1lAU" xmlns:xsd="http://ift.tt/tphNwY">
<isDisposable xmlns="http://ift.tt/1eA8QQK">
<context xmlns="">
<apiKey>*****</apiKey>
</context>
<emailAddress xmlns="">test@testmail.pl</emailAddress>
</isDisposable>
</s:Body>
</s:Envelope>
Below implementation of isDisposable method:
public MyNamespace.NameAPI.soapDisposableEmailAddressDetectorResult isDisposable(MyNamespace.NameAPI.soapContext context, string emailAddress) {
MyNamespace.NameAPI.isDisposableRequest inValue = new MyNamespace.NameAPI.isDisposableRequest();
inValue.context = context;
inValue.emailAddress = emailAddress;
MyNamespace.NameAPI.isDisposableResponse retVal = ((MyNamespace.NameAPI.SoapDisposableEmailAddressDetector)(this)).isDisposable(inValue);
return retVal.@return;
}
The difference is obvious, but how to fix my app to generate proper SOAP message?
Aucun commentaire:
Enregistrer un commentaire