WCF ServiceHost REST API goes idle after some time, returns timeout error - rest

We are facing a production-issue with WCF REST API hosted in a Windows Service.
We have clients making GET and PUT requests and also regular Ping() requests to the service from clients every 30 sec.
All the Get,Put requests work well for some time (2 or 3 days) and later at some point no WEB-API requests are served. We had to restart the Windows service again to bring back the REST-service into working state.
Client Error msg: Status Code is 503 service unavailable.
Able to reproduce the issue in local Dev-environment by below scenario.
Simulated continuous REST calls to service in local with the help of sample test client upon making Ping request every 2 seconds and Put request every 4 Seconds continuously we are able to reproduce the issue within 5 Minutest after making 68 Put requests and 152 Get requests . There was no errors logged in service. Status Code is 503 service unavailable.
Here is the server configuration for WCF REST service.
WCF REST Service Configuration:
var restURL = string.Format("{0}{1}/v{2}", (isHttps ? WsSprotocol : WsProtocol), Config.Server, Config.Version);
var webServiceHost = new WebServiceHost(typeof(EngageWebServiceHostREST), new Uri(restURL));
var webHttpBinding = new WebHttpBinding
{
Security = new WebHttpSecurity { Mode = isHttps ? WebHttpSecurityMode.Transport : WebHttpSecurityMode.None },
MaxReceivedMessageSize = int.MaxValue,
ReaderQuotas = { MaxArrayLength = int.MaxValue },
OpenTimeout = new TimeSpan(0, 01, 00),
CloseTimeout = new TimeSpan(0, 10, 00),
SendTimeout = new TimeSpan(0, 10, 00),
CrossDomainScriptAccessEnabled = true,
TransferMode = TransferMode.StreamedResponse
};
if (isHttps)
{
bindHttpCertificate(webServiceHost);
if (webServiceHost.Credentials.ServiceCertificate != null && webServiceHost.Credentials.ServiceCertificate.Certificate != null)
{
webHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
Log.Info(string.Format("Https Certificate {0} binded to {1}", webServiceHost.Credentials.ServiceCertificate.Certificate.SubjectName.Name, restURL));
}
}
var customBinding = new CustomBinding(webHttpBinding);
for (int counter = 0; counter < customBinding.Elements.Count; counter++)
{
if (customBinding.Elements[counter] is WebMessageEncodingBindingElement)
{
WebMessageEncodingBindingElement webBE = (WebMessageEncodingBindingElement)customBinding.Elements[counter];
customBinding.Elements[counter] = new GZipMessageEncodingBindingElement(webBE);
}
else if (customBinding.Elements[counter] is TransportBindingElement)
{
((TransportBindingElement)customBinding.Elements[counter]).MaxReceivedMessageSize = int.MaxValue;
}
}
ServiceEndpoint endpoint = webServiceHost.AddServiceEndpoint(typeof(IEngageWebServiceREST), customBinding, "");
endpoint.Behaviors.Add(new WebHttpBehavior() { AutomaticFormatSelectionEnabled = true, DefaultOutgoingResponseFormat = WebMessageFormat.Json });
endpoint.Behaviors.Add(new EnableCrossOriginResourceSharingBehavior());
endpoint.Behaviors.Add(new HelpPageEndPointBehavior("Product Suite"));
var serviceDebugBehaviorLocal = webServiceHost.Description.Behaviors.Find<ServiceDebugBehavior>();
if (serviceDebugBehaviorLocal == null)
{
webServiceHost.Description.Behaviors.Add(new ServiceDebugBehavior
{
IncludeExceptionDetailInFaults = true
});
}
else
{
if (!serviceDebugBehaviorLocal.IncludeExceptionDetailInFaults)
serviceDebugBehaviorLocal.IncludeExceptionDetailInFaults = true;
}
Await and appreciate ideas & thoughts to troubleshoot/resolve this issue.
Thanks,
Dileep

I suggest you refer to the following configuration.
<system.serviceModel>
<services>
<service behaviorConfiguration="Service1Behavior" name="VM1.MyService">
<endpoint address="" binding="webHttpBinding" contract="VM1.IService" behaviorConfiguration="rest" bindingConfiguration="mybinding" >
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="mybinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" sendTimeout="00:10:00" receiveTimeout="00:10:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
<security mode="Transport">
<transport clientCredentialType="None"></transport>
</security>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="False"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="rest">
<webHttp/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
Feel free to let me know if the problem still exists.

Related

Mono WCF Rest Service With Multiple Contracts "no endpoints are defined in the configuration file"

I want to host a WCF Rest Service with multiple contracts via mono each implemented in a separate partial class. I read many posts on similar issues, yet there was no solution for mono. I incorporated or at least tested all suggestions I could find and by now my code looks a lot like other solutions, yet does not work.
The application runs successfully on my local machine but throws an error once I deploy it via mono.
Service 'MyWebServiceEndpoint' implements multiple ServiceContract types, and no endpoints are defined in the configuration file.
Here is one of the endpoints with the contract. All the others are very much like this one. They all are a partial class MyWebServiceEndpoint implementing another contract.
namespace MyServer.MyEndPoints {
public partial class MyWebServiceEndpoint : INotificationEndpoint {
public string GetNotifications(int limit) {
// Do stuff
}
}
[ServiceContract]
public interface INotificationEndpoint {
[OperationContract]
[WebGet]
string GetNotifications(int limit);
}
}
My App.config looks like this. I removed the IP and port, as they are the server address.
<system.serviceModel>
<services>
<service name="MyServer.MyEndPoints.MyWebServiceEndpoint" behaviorConfiguration="WebService.EndPoint">
<host>
<baseAddresses>
<add baseAddress="http://ip:port>"/>
</baseAddresses>
</host>
<endpoint address="/message"
binding="webHttpBinding"
contract="MyServer.MyEndPoints.IMessageEndpoint"
behaviorConfiguration="WebBehavior"/>
<endpoint address="/music"
binding="webHttpBinding"
contract="MyServer.MyEndPoints.IMusicEndpoint"
behaviorConfiguration="WebBehavior"/>
<endpoint address="/notification"
binding="webHttpBinding"
contract="MyServer.MyEndPoints.INotificationEndpoint"
behaviorConfiguration="WebBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WebService.EndPoint">
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="True"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="WebBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
I open the service in C# like this.
WebServiceHost = new WebServiceHost(typeof(MyWebServiceEndpoint));
WebServiceHost.Open();
The Error message I receive on mono is:
Unhandled Exception:
System.InvalidOperationException: Service 'MyWebServiceEndpoint' implements multiple ServiceContract
types, and no endpoints are defined in the configuration file. WebServiceHost can set up default
endpoints, but only if the service implements only a single ServiceContract. Either change the
service to only implement a single ServiceContract, or else define endpoints for the service
explicitly in the configuration file. When more than one contract is implemented, must add base
address endpoint manually
I hope you have some hints or someone knows how to solve the issue. Thank you already for reading up to here.
I am not familiar with Mono, Does the Mono support Webconfig file? I advise you to add the service endpoint programmatically.
class Program
{
/// <param name="args"></param>
static void Main(string[] args)
{
WebHttpBinding binding = new WebHttpBinding();
Uri uri = new Uri("http://localhost:21011");
using (WebServiceHost sh = new WebServiceHost(typeof(TestService),uri))
{
sh.AddServiceEndpoint(typeof(ITestService), binding, "service1");
sh.AddServiceEndpoint(typeof(IService), binding, "service2");
ServiceMetadataBehavior smb;
smb = sh.Description.Behaviors.Find<ServiceMetadataBehavior>();
if (smb == null)
{
smb = new ServiceMetadataBehavior()
{
HttpGetEnabled = true
};
sh.Description.Behaviors.Add(smb);
}
sh.Opened += delegate
{
Console.WriteLine("service is ready");
};
sh.Closed += delegate
{
Console.WriteLine("service is closed");
};
sh.Open();
Console.ReadLine();
sh.Close();
}
}
}
[ServiceContract]
public interface ITestService
{
[OperationContract]
[WebGet]
string GetData(int id);
}
[ServiceContract]
public interface IService
{
[OperationContract]
[WebGet]
string Test();
}
public class TestService : ITestService,IService
{
public string GetData(int id)
{
return $"{id},";
}
public string Test()
{
return "Hello " + DateTime.Now.ToString();
}
}
Result.
According to the official documentation, we had better not use Partial class.
https://learn.microsoft.com/en-us/dotnet/framework/wcf/samples/multiple-contracts
Besides, we could consider launching multiple service host for every service implemented class.
Feel free to let me know if the problem still exists.

Is it possible to explicitly dictate which EJB Receiver is used within JBoss EAP 6?

I am trying to make remote calls to multiple servers running on one instance of JBoss EAP 6 from a client server running on a separate instance of JBoss EAP 6. I have configured for JBoss-to-JBoss remote communication, and have read about scoped EJB client contexts, but the two do not appear to be compatible. Currently, I have two EJB Receivers configured (one for each remote server), but it appears when I try to make a remote call, the initialized Context randomly selects the EJB Receiver it will use. It would seem reasonable that I can force which EJB Receiver is used when the Context is initialized if I have the remote ip and port, or the remote connection name, but alas, I don't know the the secret handshake.
host.xml:
<security-realm name="ejb-security-realm">
<server-identities>
<secret value="ZWpiUEBzc3cwcmQ="/>
</server-identities>
</security-realm>
domain.xml:
<subsystem xmlns="urn:jboss:domain:remoting:1.2">
<connector name="remoting-connector" socket binding="remoting" security-realm="ApplicationRealm"/>
<outbound-connections>
<remote-outbound-connection name="remote-ejb-connection" outbound-socket-binding-ref="mpg1-app1" username="ejbuser" security-realm="ejb-security-realm">
<properties>
<property name="SASL_POLICY_NOANONYMOUS" value="false"/>
<property name="SSL_ENABLED" value="false"/>
</properties>
</remote-outbound-connection>
<remote-outbound-connection name="remote-ejb-connection2" outbound-socket-binding-ref="mpg2-app1" username="ejbuser" security-realm="ejb-security-realm">
<properties>
<property name="SASL_POLICY_NOANONYMOUS" value="false"/>
<property name="SSL_ENABLED" value="false"/>
</properties>
</remote-outbound-connection>
</outbound-connections>
</subsystem>
...
<socket-binding-group name="full-sockets" default-interface="public">
...
<socket-binding name="remoting" port="44447"/>
<outbound-socket-binding name="mpg1-app1">
<remote-destination host="localhost" port="44452"/>
</outbound-socket-binding>
<outbound-socket-binding name="mpg2-app1">
<remote-destination host="localhost" port="44453"/>
</outbound-socket-binding>
</socket-binding-group>
jboss-ejb-client.xml
<jboss-ejb-client xmlns="urn:jboss:ejb-client:1.0">
<client-context>
<ejb-receivers>
<remoting-ejb-receiver outbound-connection-ref="remote-ejb-connection"/>
<remoting-ejb-receiver outbound-connection-ref="remote-ejb-connection2"/>
</ejb-receivers>
</client-context>
</jboss-ejb-client>
The remote call:
Context ctx = null;
final Properties props = new Properties();
props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
try {
ctx = new InitialContext(props);
MyInterfaceObject ourInterface = ctx.lookup("ejb:" + appName + "/" + moduleName + "/" + beanName + "!"
+ viewClassName);
ourInteface.refreshProperties();//remote method call
}
Any Help would be greatly appreciated!
have you try cluster-node-selector
jboss-ejb-client.xml
<!-- if an outbound connection connect to a cluster a list of members is provided after successful connection.
To connect to this node this cluster element must be defined.
-->
<clusters>
<!-- cluster of remote-ejb-connection-1 -->
<cluster name="ejb" security-realm="ejb-security-realm-1" username="test" cluster-node-selector="org.jboss.as.quickstarts.ejb.clients.selector.AllClusterNodeSelector">
<connection-creation-options>
<property name="org.xnio.Options.SSL_ENABLED" value="false" />
<property name="org.xnio.Options.SASL_POLICY_NOANONYMOUS" value="false" />
</connection-creation-options>
</cluster>
</clusters>
</client-context>
</jboss-ejb-client>
Selector Implementation
#Override
public String selectNode(final String clusterName, final String[] connectedNodes, final String[] availableNodes) {
if (availableNodes.length == 1) {
return availableNodes[0];
}
// Go through all the nodes and point to the one you want
for (int i = 0; i < availableNodes.length; i++) {
if (availableNodes[i].contains("someoneYouInterestIn")) {
return availableNodes[i];
}
}
final Random random = new Random();
final int randomSelection = random.nextInt(availableNodes.length);
return availableNodes[randomSelection];
}
For more information you can check
https://access.redhat.com/documentation/en/red-hat-jboss-enterprise-application-platform/7.0/developing-ejb-applications/chapter-8-clustered-enterprise-javab

How to configure HornetQ client with standalone server cluster (configured using JGroups TCP)

I have configured 2 hornetq standalone servers in clustered mode using groups (tcp) as i cant use default UDP. Below is the configuration.
hornetq-configuration.xml:
<broadcast-groups>
<broadcast-group name="bg-group1">
<jgroups-file>jgroups-tcp.xml</jgroups-file>
<jgroups-channel>hornetq_broadcast_channel</jgroups-channel>
<connector-ref>netty</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="dg-group1">
<jgroups-file>jgroups-tcp.xml</jgroups-file>
<jgroups-channel>hornetq_broadcast_channel</jgroups-channel>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
Jgroups.xml:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:org:jgroups"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups.xsd">
<TCP bind_port="7800"
recv_buf_size="${tcp.recv_buf_size:5M}"
send_buf_size="${tcp.send_buf_size:5M}"
max_bundle_size="64K"
max_bundle_timeout="30"
use_send_queues="true"
sock_conn_timeout="300"
timer_type="new3"
timer.min_threads="4"
timer.max_threads="10"
timer.keep_alive_time="3000"
timer.queue_max_size="500"
thread_pool.enabled="true"
thread_pool.min_threads="2"
thread_pool.max_threads="8"
thread_pool.keep_alive_time="5000"
thread_pool.queue_enabled="true"
thread_pool.queue_max_size="10000"
thread_pool.rejection_policy="discard"
oob_thread_pool.enabled="true"
oob_thread_pool.min_threads="1"
oob_thread_pool.max_threads="8"
oob_thread_pool.keep_alive_time="5000"
oob_thread_pool.queue_enabled="false"
oob_thread_pool.queue_max_size="100"
oob_thread_pool.rejection_policy="discard"/>
<TCPPING
initial_hosts="${jgroups.tcpping.initial_hosts:hornetq-server1-ip[7800], hornetq-server1-ip[7900], hornetq-server2-ip[7800], hornetq-server2-ip[7900]}"
port_range="1"/>
<MERGE3 min_interval="10000"
max_interval="30000"/>
<FD_SOCK/>
<FD timeout="3000" max_tries="3" />
<VERIFY_SUSPECT timeout="1500" />
<BARRIER />
<pbcast.NAKACK2 use_mcast_xmit="false"
discard_delivered_msgs="true"/>
<UNICAST3 />
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="4M"/>
<pbcast.GMS print_local_addr="true" join_timeout="2000"
view_bundling="true"/>
<MFC max_credits="2M"
min_threshold="0.4"/>
<FRAG2 frag_size="60K" />
<!--RSVP resend_interval="2000" timeout="10000"/-->
<pbcast.STATE_TRANSFER/>
Servers work fine i.e., if the live goes down, backup takes its place.
Client producer:
TransportConfiguration[] servers = new TransportConfiguration[2];
List<Configuration> configurations = ... // user defined class
for (int i = 0; i < configurations.size(); i++) {
Map<String, Object> map = new HashMap<>();
map.put("host", configurations.get(i).getHost());
map.put("port", configurations.get(i).getPort());
servers[i] = new TransportConfiguration(NettyConnectorFactory.class.getName(), map);
}
ServerLocator locator = HornetQClient.createServerLocatorWithHA(servers);
locator.setReconnectAttempts(5);
factory = locator.createSessionFactory();
session = factory.createSession();
producer = session.createProducer(queueName);
Client Consumer:
ClientSessionFactory factory = locator.createSessionFactory();
for (int i = 1; i <= nReceivers; i++) {
ClientSession session = factory.createSession(true, true, 1);
sessions.add(session);
if (i == 1) {
Thread.sleep(10000); // waiting to download cluster information
}
session.start();
ClientConsumer consumer = session.createConsumer(queueName);
consumer.setMessageHandler(handler);
}
Issue:
Client (producer) doesnt automatically fall back if the server connected to, goes down, while sending messages.
The sessions created using same client factory is always connecting to one server (as opposed to documentation http://docs.jboss.org/hornetq/2.3.0.beta1/docs/user-manual/html/clusters.html#clusters.client.loadbalancing)
So it seems the client never gets the cluster information. I also dont find any documentation for configuring a client to use jgroups (needed?) to connect to a hornetq cluster.
Any help is appreciated.
Figured out that i can use jgroups on client side too.
Detailed solution can be found here

how to delete a scenario in atg through API methods

I have created a scenario by creating a myScenario.sdl in my local config folder /atg/registry/data/scenarios/myScenario.sdl
myScenario.sdl
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE process SYSTEM "dynamosystemresource:/atg/dtds/pdl/pdl_1.0.dtd">
<process author="admin" creation-time="1413804041263" enabled="false" last-modified-by="admin" modification-time="1413804191188">
<segment migrate-subjects="true">
<segment-name>ItemAddedToOrder</segment-name>
<!--================================-->
<!--== Item added to order Quantity with fraction is defined -->
<!--================================-->
<event id="1">
<event-name>atg.commerce.order.ItemAddedToOrder</event-name>
<filter construct="event-property-filter" operator="isNotNull">
<event-property construct="event-property">
<property-name>quantityWithFraction</property-name>
</event-property>
</filter>
</event>
<!--================================-->
<!--== Log a message message: Quantity With Fraction is Defines logTriggeringEvent: true -->
<!--================================-->
<action id="2">
<action-name>Log a message</action-name>
<action-param name="message">
<constant>Quantity With Fraction is Defines</constant>
</action-param>
<action-param name="logTriggeringEvent">
<constant type="java.lang.Boolean">true</constant>
</action-param>
</action>
</segment>
</process>
And enabled the scenario:
Registry scenarioRegistry = scenarioManager.getScenarioRegistry();
byte[] data = (byte[]) scenarioRegistry.getItem(pScenarioPath);
String xml = null;
if (data != null) {
xml = new String(data, "UTF-8");
} else {
Assert.fail("No scenario is existed to enable/disable");
}
String updatedXml;
if (scenarioState && xml != null) {
updatedXml = xml.replaceAll("enabled=\"false\"", "enabled=\"true\"");
} else {
updatedXml = xml.replaceAll("enabled=\"true\"", "enabled=\"false\"");
}
scenarioRegistry.putItem(pScenarioPath, updatedXml.getBytes("UTF-8"));
Now with this above written code, I can both disable or enable the scenario by changing the state as false and true respectively. But I want to delete the scenario(please remember, my requirement is DELETE not DISABLE SCENARIO). I know using scenarioManager.updateScenario() deleted the scenario. Is my understanding right?
One more thing, I know I can delete the scenario directly from ACC. But I need to code via code not manually from ACC.
Please share your thoughts!
Did you try scenarioRegistry.removeItem(path);

Error: ContractFilter mismatch at the EndpointDispatcher

I am developing an iPhone app that is using the WCF to return data in json format. But when I am making call to the wcf service then I am getting the Error:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</faultcode><faultstring xml:lang="en-US">The message with Action 'IPhoneDevService/GetConferenceIdByEventUrlName' 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).</faultstring></s:Fault></s:Body></s:Envelope>
Service name : IPhoneDevService.svc there is no interface created for this.Same issue is comin g if I am using the Interface
Function :
[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehaviorAttribute(IncludeExceptionDetailInFaults = true)]
[DataContractFormat(Style = OperationFormatStyle.Document)]
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "IPhoneDevService" in code, svc and config file together.
public class IPhoneDevService
{
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
public string GetOneUserAuthentication(long confrenceid, string email, string password)
{
StringBuilder sbJson = new StringBuilder();
try
{
User[] objuserdetails = new User[1];
System.Nullable<short> strRet = 0;
string strRetMsg = string.Empty;
using (LINQTODBDataContext objDB = new LINQTODBDataContext())
{
objuserdetails = objDB.s_t_UserLoginVerifyClient(email, password, ref strRet, ref strRetMsg).Select(res => new User
{
UserID = res.UserId,
Message = ExceptionMsg.GetMessage(Convert.ToInt32(strRet), strRetMsg)
}).ToArray();
if (strRet == 2)
{
new JavaScriptSerializer().Serialize(objuserdetails, sbJson);
}
else
{
new JavaScriptSerializer().Serialize(ExceptionMsg.GetMessage(Convert.ToInt32(strRet), strRetMsg), sbJson);
}
}
}
catch (Exception ex)
{
return "";
}
return sbJson.ToString();
}
}
xcode consumption is:
NSString *soapMessage = [NSString stringWithFormat:#"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\ <http://schemas.xmlsoap.org/soap/envelope/%5C>"><SOAP-ENV:Body><GetOneUserAuthentication><confrenceid>123</confrenceid><email>demo#abc.com <mailto:demo#abc.com></email><password>abc</password></GetOneUserAuthentication></SOAP-ENV:Body></SOAP-ENV:Envelope>"];
NSURL *url = [NSURL URLWithString:#"http://mydomain.com/IPhoneDevService.svc/basic"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSString *msgLength = [NSString stringWithFormat:#&quot;%d&quot;, [soapMessage length]];
[theRequest addValue: #&quot;text/xml; charset=utf-8&quot; forHTTPHeaderField:#&quot;Content-Type&quot;];
[theRequest addValue:#&quot;IPhoneDevService/GetOneUserAuthentication&quot; forHTTPHeaderField:#&quot;SOAPAction&quot;];
[theRequest addValue: msgLength forHTTPHeaderField:#&quot;Content-Length&quot;];
[theRequest setHTTPMethod:#&quot;POST&quot;];
[theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
Service Model of WCF webconfig is:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="bhbinding" allowCookies="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceThrottling maxConcurrentCalls="400" maxConcurrentInstances="400" maxConcurrentSessions="400" />
</behavior>
<behavior name="IphoneServiceBehaviour">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<useRequestHeadersForMetadataAddress>
<defaultPorts>
<add scheme="http" port="8081" />
<add scheme="https" port="444" />
</defaultPorts>
</useRequestHeadersForMetadataAddress>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Configurator_Service.IPhoneDevService" behaviorConfiguration="IphoneServiceBehaviour">
<endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="bhbinding" contract="Configurator_Service.IPhoneDevService" />
</service>
</services>
</system.serviceModel>
It looks like you've configured your endpoint wrong.
In your WCF configuration you have:
<endpoint address="basic"
but in your XCode you specify
http://.../IPhoneDevService.svc
The endpoint address you specified in your configuration is going to look like:
http://.../IPhoneDevService.svc/basic
Typically, you just leave the endpoint address blank unless you need to have more than one (e.g. if you want to expose an MEX endpoint).