HItesh Rana
asked on
Call Java Web Service using C#
I'm using C# to call a Java Web Service. I'm using Visual Studio 2015 The company gave me wsdl file and I generated the proxy class for wse 3. I don't know WCF so I did it in wse 3
Here is my app.config file
Here is my
wse3policyCache.config file
Part of the payload is an attachment of a text file. The problem I'm having is that when I turn on mtom (<mtom clientMode="On" serverMode="always" />) I get the following error:
Error: Client found response content type of 'multipart/related; boundary="MIMEBoundary_aec b5c92eb429 27b74b62c6 38a6f50e00 4008366aba 1005a"; type="application/soap+xml "; start="<0.becb5c92eb42927b 74b62c638a 6f50e00400 8366aba100 5a@apache. org>"; action="http://TEST/Transaction/Submission"', but expected 'application/soap+xml'.
If turn mtom to off I get this error:
<soap:Fault xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><axis2ns1:Co de xmlns:axis2ns1="http://www.w3.org/2003/05/soap-envelope"><axis2ns 1:Value>en v:Sender</ axis2ns1:V alue></axi s2ns1:Code ><axis2ns1 :Reason xmlns:axis2ns1="http://www.w3.org/2003/05/soap-envelope"><soap:Te xt xml:lang="en-US">SOAP Body does not contain the CAQH CORE Connectivity Element : Checksum</soap:Text></axis 2ns1:Reaso n></soap:F ault>
So the error above is complaining that I did not attach the file. I'm assuming.
Not sure how to exactly debug this error. I'm a bit lost here. I am able to test the web service using SOAP UI where I'm able to attach the file and everything is working.
Here is my app.config file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<microsoft.web.services3>
<security>
<binarySecurityTokenManager>
<add valueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3">
<sessionKeyAlgorithm name="AES128" />
<keyAlgorithm name="RSAOAEP" />
</add>
</binarySecurityTokenManager>
<x509 storeLocation="CurrentUser" />
<securityTokenManager>
<add type="Microsoft.Web.Services3.Security.Tokens.EncryptedKeyTokenManager, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="http://www.w3.org/2001/04/xmlenc#" localName="EncryptedKey">
<keyAlgorithm name="SHA2" />
</add>
</securityTokenManager>
</security>
<diagnostics>
<trace enabled="true" input="InputTrace.webinfo" output="OutputTrace.webinfo" />
<detailedErrors enabled="true" />
</diagnostics>
<policy fileName="wse3policyCache.config" />
<messaging>
<mtom clientMode="On" serverMode="always" />
</messaging>
</microsoft.web.services3>
<appSettings>
<add key="SaveWholeSoapMessage" value="true" />
</appSettings>
</configuration>
Here is my
wse3policyCache.config file
<policies xmlns="http://schemas.microsoft.com/wse/2005/06/policy">
<extensions>
<extension name="x509" type="Microsoft.Web.Services3.Design.X509TokenProvider, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<extension name="mutualCertificate10Security" type="Microsoft.Web.Services3.Design.MutualCertificate10Assertion, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<extension name="TESTPolicyAssertion" type="TESTWS.TESTPolicyAssertion, TESTWS" />
</extensions>
<policy name="esar">
<mutualCertificate10Security establishSecurityContext="false" renewExpiredSecurityContext="false" requireSignatureConfirmation="false" messageProtectionOrder="SignBeforeEncrypt" requireDerivedKeys="false" ttlInSeconds="300">
<clientToken>
<x509 storeLocation="CurrentUser" storeName="My" findValue="xxxxxxxx" findType="FindBySubjectName" />
</clientToken>
<serviceToken>
<x509 storeLocation="CurrentUser" storeName="AddressBook" findValue="xxxxxxxxx" findType="FindBySubjectName" />
</serviceToken>
<protection>
<request signatureOptions="IncludeSoapBody" encryptBody="true" />
<response signatureOptions="IncludeSoapBody" encryptBody="true" />
<fault signatureOptions="" encryptBody="false" />
</protection>
</mutualCertificate10Security>
<TESTPolicyAssertion/>
</policy>
</policies>
Part of the payload is an attachment of a text file. The problem I'm having is that when I turn on mtom (<mtom clientMode="On" serverMode="always" />) I get the following error:
Error: Client found response content type of 'multipart/related; boundary="MIMEBoundary_aec
If turn mtom to off I get this error:
<soap:Fault xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><axis2ns1:Co
So the error above is complaining that I did not attach the file. I'm assuming.
Not sure how to exactly debug this error. I'm a bit lost here. I am able to test the web service using SOAP UI where I'm able to attach the file and everything is working.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@ste5an. I added the service reference by the file and now I get a 400 bad request error.
That's the problem with separate WSDL files.. they are easily out of sync with the deployed service.
There is no activity from author
ASKER