I have an .asmx webservice which works properly for my android client. Right now I'm trying to migrate to WCF but haven't succeeded yet.
My configuration looks like:
<system.serviceModel>
<services>
<service name="myTimeMvc.Webservice.MyTimeService" behaviorConfiguration="returnFaults">
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint binding="customBinding" bindingConfiguration="MyCustomHttpBinding" contract="myTimeMvc.Webservice.IMyTimeService" />
</service>
</services>
<bindings>
<customBinding>
<binding name="MyCustomHttpBinding">
<textMessageEncoding messageVersion="Soap12" />
<context protectionLevel ="None"/>
<httpTransport transferMode ="Buffered" />
</binding>
</customBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="returnFaults">
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
I already tried lots of configuraitons. Shouldn't actually the default settings fullfill my needs. Defaults is basicHttpBinding with SOAP, right?
My contracts look like:
[ServiceContract(Namespace = Constants.Namespace)]
public interface IMyTimeService
{
[OperationContract]
UserData getUserByEmail(String mail);
...
Constants.Namespace has the following value:
public class Constants
{
// Ensures consistency in the namespace declarations across services
public const string Namespace = "http://timemanagement.mxp/";
}
My android side looks like:
final String soap_action = soap_action_getUserByEmail;
SoapObject request = new SoapObject(SOAP_NAMESPACE, soap_action);
request.addProperty("mail", email);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
// try {
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_NAMESPACE + soap_action, envelope);
User usrNew = new User();
SoapObject result = (SoapObject) envelope.bodyIn;
Values on Adroid side are:
static final String URL = "http://192.168.1.5/myTime/Webservice/MyTimeService.svc";
static final String SOAP_NAMESPACE = "http://timemanagement.mxp/";
// Users
public final static String soap_action_addUser = "addUser";
public static final String soap_action_getUsers = "getUsers";
public static final String soap_action_getUserByEmail = "getUserByEmail";
Right now I'm getting the following error: ode: s:Sender, Reason: The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
Can't see any problem in wireshark.
<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://www.w3.org/2003/05/soap-encoding" xmlns:v="http://www.w3.org/2003/05/soap-envelope"><v:Header /><v:Body><getUserByEmail xmlns="http://timemanagement.mxp/" id="o0" c:root="1"><mail i:type="d:string">omnia.cyano@gmail.com</mail></getUserByEmail></v:Body></v:Envelope>
Can anyone help me with that?
Cheers, Stefan