none
WCF client consuming java web service. RRS feed

  • Question

  • I am writing the .net wcf client for consuming the  java web service (www.eMedNY.org)

    I have followed all the instaruction from http://webservices20.blogspot.in/2014/06/emedny-web-services-in-net-guest-post.html

    I am getting the error Hash values do not match. (from client) for the  username

    POST https://service100.emedny.org:9047/MHService HTTP/1.1
    Content-Type: text/xml; charset=utf-8
    SOAPAction: ""
    Host: service100.emedny.org:9047
    Content-Length: 6012
    Expect: 100-continue
    Accept-Encoding: gzip, deflate
    Connection: Keep-Alive

    <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><VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPo8KSDfrL6rBLtzhq46a8kTIAAAAAsK1lYJPvBEmE3j2FlBXZTfTEvddpx8FFoFla9fvG/R8ACQAA</VsDebuggerCausalityData><o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><o:BinarySecurityToken u:Id="uuid-00604a9f-e3b3-43a0-a639-60ad15495cbd-3" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">MIIC+jCCAmOgAwIBAgICAawwDQYJKoZIhvcNAQEFBQAwNjEPMA0GA1UEChMGZU1lZE5ZMSMwIQYDVQQLExpyUHJkIENlcnRpZmljYXRlIEF1dGhvcml0eTAeFw0xNjA1MDkwNDAwMDBaFw0xNjExMTAwNDU5NTlaMGIxDzANBgNVBAoTBmVNZWROWTEUMBIGA1UECxMLZU1lZE5ZLVBST0QxDzANBgNVBAsTBmVQYWNlczEVMBMGA1UECxMMZVBhY2VzIENlcnRzMREwDwYDVQQDEwhKR09STUFOOTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKnapxgU8t55GXmWvlxku1HZondwnFGre3o9ePLVazUCes9gcprgvUmIJMHpasjDzZGcDRWj7mdrTNBh2ravZvvumfhEDph1nYESPUmib4DHpPytjHg/9SJA2dVX8Vf5WXno7IYFdSNafWn+7QjNVQZ4MVgwMApeuPctrijvZfnV5iw4W+PZ352FkIC368cXHUtm4YykzzxIUeQ72GepEK6Q+Jfg+0Of74yCRvJMpNeIgPZz3+n3wPqIMO2fCe96ge1YkiMa10B3kt6ma8KOy7DWi9mRqLriLOZvAKcv8RwdAV71fk+b5SOLaX4kqLppfuRkudkY+uDYsfcMLz16VnkCAwEAAaNnMGUwDgYDVR0PAQH/BAQDAgTwMBMGA1UdJQQMMAoGCCsGAQUFBwMCMB0GA1UdDgQWBBRnlS95GMdBIXAxB87GKKo79vo6kjAfBgNVHSMEGDAWgBTBuje1dEVyTTA3mDYM9L7/7FUedDANBgkqhkiG9w0BAQUFAAOBgQClFBx1MZZaBudebqQ0cjll3XeI4cmKWTcgK9Uyo1CnAsUNVJ3A5LXHyvOi/QmTFFqUfzqARXU8AE1/1MqOfMubVEkVclv00nJ9S6+YZ3t1DuopLkVCFgqwxecZHdFvZlLZcKmwDGZObWJDE+KUIVpc4rs0gaxKF8/Do2b9nd6+Rw==</o:BinarySecurityToken><e:EncryptedKey Id="_0" xmlns:e="http://www.w3.org/2001/04/xmlenc#"><e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/><KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"><o:SecurityTokenReference><o:KeyIdentifier ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">WwRKuiXJ0r+vSeYbygGXT6bVovc=</o:KeyIdentifier></o:SecurityTokenReference></KeyInfo><e:CipherData><e:CipherValue>ZmPus9f1sNLaQ06ejgrzOaZ84l8lHJ4PTqzpjSuaOCIUeCtAn7ZjLZ5Mze91Ia7KDo5kKjxMBxHsG/ohBIYAT8wj0rKi+5YJam9G4dGmqui3OO7FO2jVOCmlWuf38AOLDYoXajL5L1X5kv3VB8iKgchX/qwMqkLwJBEmTgelG28=</e:CipherValue></e:CipherData><e:ReferenceList><e:DataReference URI="#_2"/></e:ReferenceList></e:EncryptedKey><o:UsernameToken u:Id="uuid-00604a9f-e3b3-43a0-a639-60ad15495cbd-1"><o:Username>JGORMAN9</o:Username><o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">pass</o:Password><o:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">tKGPK+cG1ul30eoZookpfrj5Jks=</o:Nonce><u:Created>2016-06-18T11:07:30.764Z</u:Created></o:UsernameToken><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><Reference URI="#_1"><Transforms><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><DigestValue>bVGhimy6QGj6Hl7wfR9znzLUpNk=</DigestValue></Reference><Reference URI="#uuid-00604a9f-e3b3-43a0-a639-60ad15495cbd-1"><Transforms><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><DigestValue>/yFO1buJkKZLUmRnxTMncmoPDKs=</DigestValue></Reference></SignedInfo><SignatureValue>kfOPh34ZLTQZPc3xP731d2VQY0bMSW1q/iTTQocsDs4sI1mWUgDGmkE6PYB0EIP3ezKO3BcaJ+0AG8xmcDEqe7TaAFaZJx1czWpERw7jd/DOR7w8CY09r3jnfU66GoBpB7sIlaTu48IsVgFE8JGZaQlMxhfbhczXSCtjPj/JZrzRzZM4tERUiyDp/CbH5blDfLR9+8GF7I5+/NcGj9N5JJs5wQFCiBAlRQDFqReRNFzX1yjdOxlhoD337q/e7YAGRetuKH3wVrNLcBVGxDvqZ15iqYV+YF1ZUWxs5ycMiLhm9/CjvVAF+Q+CNEo4NMVAdNwI36/Gqpni3GfDgA+QvA==</SignatureValue><KeyInfo><o:SecurityTokenReference><o:Reference ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" URI="#uuid-00604a9f-e3b3-43a0-a639-60ad15495cbd-3"/></o:SecurityTokenReference></KeyInfo></Signature></o:Security></s:Header><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>KNjW26oTljgrZ5waEOfmIu90vNYkDstt7BOYXdiarI4iMQd0HpIi3VHGjer8o4k+5rjWo+TLj5/cOb4ObY4GeYo9h5j8O3XfhVllDsY66wd3Jw4Z3p+HTvhCF7oMl3/j+ZgSAO8XNhbvPJlsVZoxBfvNxVXJBBjdjXQmvzFYHxEOKKDrGKNufHBlmM5xmBrcTzVqTBw45U1MAA4NG2YKT9cuOiI5ZZ924nwSJyRGeE0j2xHO6SnuukpCbEXG9YhjY0odkIEXjx44ptDxbcpMlQXJqV9WY9oc4fzAQCkDPesYD2vmSebZt8kL9qO1DD/QKOVnexyCh0J5WjALYp7R8XCxx3vtvXG/1LcrAfmU60IuCLR+uzNAF/S0kmgHxqfJSpo0nsmfObaIgcKvD9mHPvMCsuD3m4g+57ioqZ6ho2f/w4zx7FEgNl25je4kfAyA19kHkGRupRQTcRhcH0lhHuDbjwysr1pXVsmAQ/yFtbAefBVJLuUw68TATyOmwCv/Jmoax9ScwKGD/1+b9fQwJSbrfUs4ZEVAParCsQbx0sl+SRMlY2yuiMbOf16zgVheqGIFBpXEoywSn8Tx/j9NORtX0vQrkzt1Z7YSkn3OnSkiJl9RALKtRX4CetMLaVy8K8kmTI/NxwFVbFFGsv+kaEOzL4TFfklfgRGnh+HUgivH0X4KdhMeHif4EAl1DOzxNl5Y7N8sSzLyX7wVSiGQltHWU47zan/iHgFzM5n1/Mb57AmagQOc75McGEhZt9cOoWzfBzl1ycAZiE95nWeSsqNCVKop9m7bj5jYhHNo9sTZHevoU9g9JLbDWb3Vyya+yQIViTWh93eStpVRLE7yAaTdW3eFCfHtgWP6Srasg3xyUrz/LBRFS1J7+0BTs0wxizStm98yCkkUt9wkJXRVLTc67s5U1RPaX2v0iUNsVTbbZ78AxjtenVk8be2rQ/n8j0n8GR14hbKasllbuRExBc0xzYJg1KIw/JQeL4LVSWH/bKP7l/m24Tvy2rc4duoXyBKnwmNW3lYi3EO//Jsp5g==</e:CipherValue></e:CipherData></e:EncryptedData></s:Body></s:Envelope>
    Saturday, June 18, 2016 5:50 PM

All replies

  • I am consuming a java web service by using .net wcf client and written  custom MTOM binding.

    in client I am not read the file (byte[] ) because I am getting the response in xop:Include tag.

    my client is not able to deserilize it

    HTTP/1.1 200 OK

    X-Backside-Transport: OK OK,OK OK,OK OK,OK OK
    Connection: Keep-Alive
    Date: Sat, 18 Jun 2016 16:51:20 GMT
    Content-Type: application/xop+xml; type="application/soap+xml"; action="http://newmmis.eohhs.ma.gov/extinterfaces/HTSCoreSafeHarbor/SOAP/CORETransactions/BatchResultsRetrievalTransactionResponse"
    Set-Cookie: JSESSIONID=UW9kbIJgPRxbiizu3j_mQr0ArKD0BK4spu6rNiAQd467wIisMb-I!-789890328; path=/; HttpOnly
    X-Client-IP: 170.63.139.20,170.63.70.73,170.63.70.73,1.39.13.112
    X-Archived-Client-IP: 170.63.139.20,170.63.139.20,170.63.70.73,170.63.139.20,170.63.70.73,170.63.70.73
    X-Global-Transaction-ID: 100876220
    Content-Length: 987

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns1:COREEnvelopeBatchResultsRetrievalResponse xmlns:ns1="http://newmmis.eohhs.ma.gov/extinterfaces/HTSCoreSafeHarbor/serviceobjects"><PayloadType>X12_271_Response_005010X279A1</PayloadType><ProcessingMode>Batch</ProcessingMode><PayloadID>039f34b4-41e9-4f7c-9c13-1b82a1145045</PayloadID><PayloadLength>20750</PayloadLength><TimeStamp>2016-06-18T12:51:20Z</TimeStamp><SenderID>MMIS</SenderID><ReceiverID>110030995F</ReceiverID><CORERuleVersion>2.2.0</CORERuleVersion><CheckSum>ccd3bc0234ee42fa7a843a18654fcb5e33a77fba</CheckSum><Payload><xop:Include href="cid:1.c046fe8da5da5470e29175ca93175ad9520985c0d3e90074@apache.org" xmlns:xop="http://www.w3.org/2004/08/xop/include"/></Payload><ErrorCode>Success</ErrorCode><ErrorMessage>Envelope was processed successfully.</ErrorMessage></ns1:COREEnvelopeBatchResultsRetrievalResponse></soapenv:Body></soapenv:Envelope>
    Saturday, June 18, 2016 5:57 PM
  • Hi som,

    >>in client I am not read the file (byte[] ) because I am getting the response in xop:Include tag.

    Could you please tell us how do you call the Java Web Service from the WCF client? By using the Add Service reference or Svcutil tool or others? It will be better if you can give us the related code. 

    For the xop:Include tag, one way is that we can use the message inspectors to modify it to meet your client requirement. Or we can deserialize the MTOM/XOP data by following this thread:
    http://stackoverflow.com/questions/10531128/parse-deserialize-mtom-xop-data-net .

    For the detailed information about how to call the Java Web Service from the WCF client, please try to refer to the following articles:
    #Consuming a Java Web Service with a .NET Client:
    http://www.codeproject.com/Articles/608365/Consuming-a-Java-Web-Service-with-a-NET-Client .
    https://blogs.msdn.microsoft.com/bursteg/2008/07/19/how-to-call-a-java-ee-web-service-from-a-net-client/ .

    Besides, for the question related with Java web services, it will be better if you can post it in this forum for the next time.
    #WCF, ASMX and other Web Services:
    http://forums.asp.net/28.aspx/1?WCF+ASMX+and+other+Web+Services .

    Thanks for your understanding.

    Best Regards,
    Amy Peng

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.












    Monday, June 20, 2016 4:40 AM
    Moderator
  • I have generated the proxy using svcutil. [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType="base64Binary", Order=9)] public byte[] Payload { get { return this.payloadField; } set { this.payloadField = value; } } this is the property in the class. this is the raw response from fiddler. HTTP/1.1 200 OK X-Backside-Transport: OK OK,OK OK,OK OK,OK OK Connection: Keep-Alive Date: Sat, 18 Jun 2016 16:51:20 GMT Content-Type: application/xop+xml; type="application/soap+xml"; action="http://newmmis.eohhs.ma.gov/extinterfaces/HTSCoreSafeHarbor/SOAP/CORETransactions/BatchResultsRetrievalTransactionResponse" Set-Cookie: JSESSIONID=UW9kbIJgPRxbiizu3j_mQr0ArKD0BK4spu6rNiAQd467wIisMb-I!-789890328; path=/; HttpOnly X-Client-IP: 170.63.139.20,170.63.70.73,170.63.70.73,1.39.13.112 X-Archived-Client-IP: 170.63.139.20,170.63.139.20,170.63.70.73,170.63.139.20,170.63.70.73,170.63.70.73 X-Global-Transaction-ID: 100876220 Content-Length: 987 <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns1:COREEnvelopeBatchResultsRetrievalResponse xmlns:ns1="http://newmmis.eohhs.ma.gov/extinterfaces/HTSCoreSafeHarbor/serviceobjects"><PayloadType>X12_271_Response_005010X279A1</PayloadType><ProcessingMode>Batch</ProcessingMode><PayloadID>039f34b4-41e9-4f7c-9c13-1b82a1145045</PayloadID><PayloadLength>20750</PayloadLength><TimeStamp>2016-06-18T12:51:20Z</TimeStamp><SenderID>MMIS</SenderID><ReceiverID>110030995F</ReceiverID><CORERuleVersion>2.2.0</CORERuleVersion><CheckSum>ccd3bc0234ee42fa7a843a18654fcb5e33a77fba</CheckSum><Payload><xop:Include href="cid:1.c046fe8da5da5470e29175ca93175ad9520985c0d3e90074@apache.org" xmlns:xop="http://www.w3.org/2004/08/xop/include"/></Payload><ErrorCode>Success</ErrorCode><ErrorMessage>Envelope was processed successfully.</ErrorMessage></ns1:COREEnvelopeBatchResultsRetrievalResponse></soapenv:Body></soapenv:Envelope>
    Monday, June 20, 2016 5:34 AM
  • Hi som,

    Thanks for your cooperation.

    Have you tried to consume the Java Web Service by using the Add Service Reference?

    I will try to follow this article: http://webservices20.blogspot.in/2014/06/emedny-web-services-in-net-guest-post.html in my side to see if I can reproduce your issue.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Monday, June 20, 2016 5:41 AM
    Moderator
  • any update on this.
    Friday, June 24, 2016 4:45 AM
  • Hi som,

    I have tried to follow this article: http://webservices20.blogspot.in/2014/06/emedny-web-services-in-net-guest-post.html. But I have met the "401 Unauthorized" error and I do not have the correct credential when using the svcutil.exe for this wsdl:https://service01.emedny.org:7602/MHService?wsdl to get appropriate proxy and config files.

    In order to help you for this scenario, I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, June 29, 2016 3:14 AM
    Moderator
  • u can use https://service100.emedny.org:9047/MHService?wsdl for gettig the wsdl.
    Wednesday, June 29, 2016 1:25 PM
  • Hi Som,

    When executing "svcutil.exe https://service100.emedny.org:9047/MHService?wsdl for gettig the wsdl", I got the following error. If I can manager to get the proxy, then I can try to reproduce the issue.

    E:\MSWorkspace\Tools\WCF>SvcUtil.exe https://service100.emedny.org:9047/MHService?wsdl
    Microsoft (R) Service Model Metadata Tool
    [Microsoft (R) Windows (R) Communication Foundation, Version 4.6.81.0]
    Copyright (c) Microsoft Corporation.  All rights reserved.

    Attempting to download metadata from 'https://service100.emedny.org:9047/MHService?wsdl' using WS-Metadata Exchange or DISCO.
    Microsoft (R) Service Model Metadata Tool
    [Microsoft (R) Windows (R) Communication Foundation, Version 4.6.81.0]
    Copyright (c) Microsoft Corporation.  All rights reserved.

    Error: Cannot obtain Metadata from https://service100.emedny.org:9047/MHService?wsdl

    If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.  For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.


    WS-Metadata Exchange Error
        URI: https://service100.emedny.org:9047/MHService?wsdl

        Metadata contains a reference that cannot be resolved: 'https://service100.emedny.org:9047/MHService?wsdl'.

        Could not establish trust relationship for the SSL/TLS secure channel with authority 'service100.emedny.org:9047'.

        The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

        The remote certificate is invalid according to the validation procedure.


    HTTP GET Error
        URI: https://service100.emedny.org:9047/MHService?wsdl

        There was an error downloading 'https://service100.emedny.org:9047/MHService?wsdl'.

        The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

        The remote certificate is invalid according to the validation procedure.

    If you would like more help, type "svcutil /?"

    Best regards,

    Zhiqing


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Wednesday, July 6, 2016 9:58 AM
  • Run fiddler before running the svc tool. 
    Thursday, July 7, 2016 12:35 PM
  • Hi Som,

    After using Fiddler I got the following error which shows that the metadata cannot be obtained.

    ==========

    E:\MSWorkspace\Tools\WCF>svcutil.exe https://service100.emedny.org:9047/MHService?wsdl

    Microsoft (R) Service Model Metadata Tool

    [Microsoft (R) Windows (R) Communication Foundation, Version 4.6.81.0]

    Copyright (c) Microsoft Corporation.  All rights reserved.

    Attempting to download metadata from 'https://service100.emedny.org:9047/MHService?wsdl' using WS-Metadata Exchange or DISCO.

    Microsoft (R) Service Model Metadata Tool

    [Microsoft (R) Windows (R) Communication Foundation, Version 4.6.81.0]

    Copyright (c) Microsoft Corporation.  All rights reserved.

    Error: Cannot obtain Metadata from https://service100.emedny.org:9047/MHService?wsdl

    If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.  For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.

    ================

    Best Regards,

    Zhiqing


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Thursday, July 14, 2016 1:58 PM