.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

WCF and Java Web Service Interop -- WS-Securtity 1.0 with MutualCertificate

Posted By:      Posted Date: August 30, 2010    Points: 0   Category :WCF
I am trying to use WCF to call a Java Web Service.  The Web Service has several security requirements based on the Basic Security Profile 1.0:- The client and service should both use certificates  - The certificates will be used to sign and encrypt the message.- In addition, a supporting UsernameToken should be included.Based on those requirements, it seems like I should be using the MutualCertificate (or MutualCertificateDuplex) authentication mode:<customBinding> <binding name="Custom11">  <textMessageEncoding messageVersion="Soap11" />  <security defaultAlgorithmSuite="TripleDesRsa15" allowSerializedSigningTokenOnReply="true"    authenticationMode="MutualCertificate" requireDerivedKeys="false"    includeTimestamp="true" messageProtectionOrder="EncryptBeforeSign"    messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"    requireSecurityContextCancellation="false">  </security>  <httpTransport /> </binding></customBinding>And then I need to add a supporting token for the user name.  Something like:BindingElementCollection elements = binding.CreateBindingElements();SecurityBindingElement security = elements.Find<SecurityBindingElement>();UserNameSecuri

View Complete Post

More Related Resource Links

WCF - Java web service interop - Signed outgoing message not accepted

Hi, I try to sign a message using a certificate and a private key to call a java (JBoss) web service, but the server refuses to accept my signed message. It only echoes back the same message that I've sent. I have successfully signed the outgoing message using the certificate, and the structure of the message look alright when I compare it to an exampel message supplied by the web service creator. I use a custom binding declared as shown below <binding name="FSACustomServiceBinding"                  closeTimeout="00:01:00"                  openTimeout="00:01:00"                  receiveTimeout="00:10:00"                  sendTimeout="00:01:00">           <textMessageEncoding             messageVersion="Soap11" />           <security             authenticationMode="MutualCertificate"             requireDerivedKeys="false"             keyEntropyMode="ClientEntropy"        &nb

WCF - Java web service interop - Problem with asymmetric binding

Hi, I try to communicate with a Java web service and run into the following error: Error: System.ServiceModel.Security.MessageSecurityException: The incoming message was signed with a token which was different from what used to encrypt the body.  This was not expected. Server stack trace:    at System.ServiceModel.Security.TokenTracker.RecordToken(SecurityToken token)    at System.ServiceModel.Security.ReceiveSecurityHeader.ReadToken(XmlDictionaryReader reader, Int32 position, Byte[] decryptedBuffer, SecurityToken encryptionToken, String idInEncryptedForm, TimeSpan timeout)    at System.ServiceModel.Security.ReceiveSecurityHeader.ExecuteFullPass(XmlDictionaryReader reader)    at System.ServiceModel.Security.StrictModeSecurityHeaderElementInferenceEngine.ExecuteProcessingPasses(ReceiveSecurityHeader securityHeader, XmlDictionaryReader reader)    at System.ServiceModel.Security.ReceiveSecurityHeader.Process(TimeSpan timeout, ChannelBinding channelBinding, ExtendedProtectionPolicy extendedProtectionPolicy)    at System.ServiceModel.Security.MessageSecurityProtocol.ProcessSecurityHeader(ReceiveSecurityHeader securityHeader, Message& message, SecurityToken requiredSigningToken, TimeSpan timeout, SecurityProtocolCorrelationState[] correlationStates)    at System.ServiceModel.Security.AsymmetricSecurity

WCF client Java interop - No Response Headers = MessageSecurityEx

I am using a WCF client to communicate with a Websphere hosted web service.  The service requires my message to be signed, but not encrypted.  This is being done and works as expected.  I can see in my trace logs that I get a valid response back from the service.  However, it isn't making past the proxy becuase of the following error: System.ServiceModel.Security.MessageSecurityException: Security processor was un able to find a security header in the message. This might be because the message  is an unsecured fault or because there is a binding mismatch between the commun icating parties.   This can occur if the service is configured for security and the client is not using security. I've edited the binding to remove the timestamp and have verified that it is not being sent, however, I still get this error.   Here's what the header of my request looks like: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <s:Header> <ActivityId CorrelationId="b0d474df-8b00-4c30-bd05-d1e478529ce4" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">cb8e51de-83b4-4bfe-bf1c-fd92ce86f557</ActivityId> <o:Security s:mustUnderstand="1" xmlns:o="http://

.NET Client and Java Web Service Interoperability

I have a .net client that consumes an operation on a java based web service that appears to work accept for an issue with passing Boolean values back to the service in the soap message. Any member of the complex type that are defined as Boolean in the service contract will not be present in the soap message generated from the client even though they are set in the code. Sample Client Code: UpdateChecklistItemStatusPortTypeClient     proxy = new UpdateChecklistItemStatusPortTypeClient();     updateChecklistItemStatusReq request = new updateChecklistItemStatusReq(); request.ouid =   "P000122112"; request.applicationId =   "00000032"; request.adminFunction =   "ADMA"; request.checklistItemTypeCode =   "UHSTRN"; request.ceebCode =   "052046"; request.transcriptTerm =   "FINAL"; request.transcriptScores =   true;     updateChecklistItemStatusRsp response = new updateChecklistItemStatusRsp(); response = proxy.UpdateChecklistItemStatusOp(request); Client Soap Message Generated: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">   

WCF Security Interoperability with Java web service

Hi everybody, I'm implementing a WCF client which talks to a Java web service secured with x509 certificates and username token. The service requires both signing and encryption as message protection. Thanks to Yaron Naveh and some other guys on this forum I've managed to solve the signing stuff, but the encryption seems to be much more difficult. The problem I'm facing now is the server cannot decrypt my messages - I'm getting HTTP 500 errors. I've got a request example from the service vendor and compared with the messages my client generates, there is only one difference: in the example provided by service vendor I can see an extra tag KeyInfo under the EncryptedData, which seems to me reasonable to be there, but I don't know why WCF doesn't put that item. These are the two SOAP request sections I'm talking about: My WCF client: <s:Body u:Id="_1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <e:EncryptedData Id="_2" Type="http://www.w3.org/2001/04/xmlenc#Content" xmlns:e="http://www.w3.org/2001/04/xmlenc#"> <e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/> <e:CipherData> <e:CipherValue> <!-- Removed--> </e:CipherValue> </e:Cipher

problem with calling soap service written (most probably in java)

Hi evebody, I'm experiencing problem calling third-party service written in java (mostprobably). When i call service i get following response: <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> <env:Header></env:Header> <env:Body> <env:Fault xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> <faultcode>env:Server</faultcode> <faultstring>Content root name does not match element name: {http://foo.bar/}arg0 != arg0</faultstring> </env:Fault> </env:Body> </env:Envelope> I've used command line java utility provided by service provider and found following difference: soap request, generated by wcf (similar results with webservices)   <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <baz xmlns="http://foo.bar/"> <arg0 xmlns="">string value</arg0> <arg1 xmlns="">string value</arg1> <arg2 xmlns="">string value</arg2> </baz> </s:Body> </s:Envelope> request, generated by java utility: <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:baz xmlns:ns2="http://foo.bar/"> <arg0>string value</arg0> <arg

How to consume java base SOAP web service XWSS?


I have java base SOAP web service XWSS. I installed WES 3.0 + VS2008

When I’s setting Security.Takens.Add() I’m getting message:
SoapContext.Security is obsolete.
Consider deriving from SendSecurityFilter or ReceiveSecurityFilter and creating a custom policy assertion that generates these filters.

Does it require some web service updates?
Do you have any samples how to create Custom Policy?

calling JAVA web service?




I am totally a beginner in web service. My vendor provide me a Java base web service and I just create a windows application to test it.  However, when i call the service, it returns including part of the previous result. My vendor doesn't know anything about .NET and they say should be my cookies problem. I tried many different methods but the problem still exist.

I add the web service by using service reference and I also have to change the allowCookies to "true" to make it work. My config as below, does anyone have any clue? I can only call the service using the second endpoint 12 because the endpoint 11 doesn't work at all.


        <binding name="SearchProcessServiceSoap11Binding" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostN

WSE 2.0 to WCF connect to Java service


Hi All,

I currently have a WSE 2.0 client that connects successfully to a Java web service and I'm trying to get a WCF client to do the same thing. I've tried basicHttpBinding, wsHttpBinding, and also customBinding with different variations with no success. I'm hoping if I post my _working_ WSE client code that someone can easily translate it to either a config or code based solution.

string _javaSignCertName = "java_messagesign_test";
string _javaSSLCertName = "*.javaWS.com"
string _javaWebServiceURL = "https://javatest.javaservices.com:443/JavaServiceWS";
javaServiceWS_vs0 javaService = null;

// WSE 2.0 method
X509CertificateStore store = X509CertificateStore.LocalMachineStore(X509CertificateStore.MyStore);


// Look in the local machine store.
X509CertificateCollection col = (X509CertificateCollection)store.FindCertificateBySubjectString(_javaSignCertName);
Microsoft.Web.Services2.Security.X509.X509Certificate cert = 

WS-Security, WS-SecurityPolicy, and Java interop


I have a service that I'm trying to consume with a java client (and JBossWS). The problem I'm facing is that JBossWS supports WS-Security but not WS-SecurityPolicy.  From what i've gathered (on msdn and google) is that by adding 'Username' authentication WS-SecurityPolicy is added to the wsdl by default. Our java client is requesting that the WS-Security should be added while removing WS-SecurityPoicy.  Is that possible?


<wsp:Policy xmlns:wsp='http://schemas.xmlsoap.org/ws/2004/09/policy' xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd' wsu:Id='ProductionBinding_policy'>
<sp:TransportBinding xmlns:sp='http://schemas.xmlsoap.org/ws/2005/07/securitypolicy'>
<sp:HttpsToken RequireClientCertificate='false'/>
WCF Endpoint Binding:

<binding name="soapBinding">
<security authenticationMode="UserNameOverTransport" enableUnsecuredResponse="True" />
<textMessageEncoding messageVersion="Soap11" />

WCF interoperability with Java SOAP service - sign elements order, force wsu id value



I need to consume a SOAP web service created in Java from a WCF client. By intensively searching this on the web in general and on this forum in particular, I've seen that quite a lot of people have problems in this area, however I never found the answer to the questions I will post on this thread.

The service I have to consume has the following constraints:

  • needs transport level security by communicating over HTTPS 
  • needs signatures on the body (soap:body element) and a custom header of each request. The signature is done using a client certificate and complies with http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0.pdf. The signature is required only on requests. Service responses are not signed.

After an intensive amount of work I managed  to make my request messages look like (intercepted with fiddler):

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u<

WCF Service for Java clients


I'm developing WCF service that looks like will be used by Java clients. Message will be signed by certificate.

Expected request looks like:

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity- secext-1.0.xsd"
   <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
     <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
     <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1" />
     <ds:Reference URI="#body">
       <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
      <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
      <ds:DigestValue>[body digest value]</ds:DigestValue>

Can not consume web service produce by Oracle and Java


 I have a hardtime to consume this web service as Web Reference or Service Reference:


I'm using VS2010 and when I consume  it as Web Reference, I can't use its method because in the reference.cs, it has these errrors:

 // CODEGEN: The operation binding 'getStationCharacteristicSummary' from namespace 'http://gov.epa.storet.stationcatalogservice/StationCatalogService.wsdl' was ignored. The encoding '' is not supported.

If i consume it as WCF, then each time I call the service, it complained the encoding error...

May someone try to consume it and help me with this.

Many thanks for your help,






C# reading Java/Php/SOAP service, WSDL generated file missing some namespace information

I'm trying to use a Web Service, which I believe is Java/php/SOAP, using C#.
I can connect and send fine, but the results, which are an array of information,
is null. The return is not instant, and I can get back errors.
I believe the problem is in the WSDL translation. The actual response coming back
does not line up with the WSDL generated code in reguards to namespaces. In
perticular, 'getCategoryTreeResponse' & 'getCategoryTreeResult' do not show up 
in the generated file.
I'm quite sure the WSDL file provided is poorly written but I have no control
over it. WSDL.exe only works when I pass a saved copy of the web service's
provided WSDL information due to the way it is called.

Consuming WCF Service in Java


Hi Guys,

I am working on a project, where I need to design a wcf service. Client may have a requirment to expose that service to other languages like Java. The question, I have, is that possible? I mean, lets say I have some custom classes like customer, order, product. I create those as DataContracts. In service I create a service operation that return List<Custom> or List<Product> or List<Order> or even an object of Product, Order or Customer. If I have these kind of service operations, would that be possible that I can use those in Java.

In case, if that not possible then in that case, should I be using standard data types like array of objects, string, xml etc?


consume java web service from C#


I'm new to consuming a non .NET web service from .NET. Here is my dilemma, I have a java web service that is using SOAP, I have a web page that I need to consume the Java web service via SOAP, can anyone point me in the right direction to get started?

1. is there a different way to consume the java web service other then [add web reference] and then point to the WSDL location?

2. what do i need to pass SOAP envelopes to the web service?


any help is greatly appreciated.

Dot Net WCF accessing Java Web Service which exposes a Java Output Stream


Hi Folks,

I am working on a project where the WCF code calls a Java Web Service which exposes a Java OutputStream.

When this java output stream is accessed from dot net, dot net is not able to read from it (or) cast it to any of the .Net available streams like for example (System.IO.Stream) or httpresponse or httprequest streams.

Has anyone tried accessing java streams over a proxy coming from a java web service through WSDL.

The error we get is : Cannot implicitly convert ProjectName.ServiceRefName.OutputStream to System.IO.Stream



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend