WebService: solutions to problems related to Java client +. Net WSE 2.0

Source: Internet
Author: User

Recently, we have been working as a data service provided by other organizations. Because the clients of different units are different, we have considered using WebService to provide data interfaces. To improve security, we adopt the WSE Security Authentication solution. However, it is restricted by the objective environment of the server, so it can only be used. net Framework 1.1 + wse2.0 SP3 (it is recommended that the server install some packet capture tools or learn to open the input and output and feedback details, so as to facilitate debugging and locate problems ). Here is why wse2.0 will be described later. On the client side, we have simulated the C # client and Java client, and found some solutions for some problems encountered. Here we will share with you.

1. When wse1.0 and Java client are used for calling, the system prompts that the SOAP header information is incorrect.

If. when wse1.0 is used on the Net Server and userNameToken is used for verification, when the Java client also transmits the usernametoke information to the server, the error "Incorrect SOAP Header" will be prompted,. there is no problem with the. NET client, which is why WSE 2.0 or later is used.

2. When wse2.0 or Java client is called, The system prompts "nonce and created" node is missing.

This problem occurs because the soap information transmitted by Java is incomplete or cannot be recognized by the. NET Server. The solution is either to allow the server to add two WSE nodes in the transmitted soap information, such:

// Add a nonce NodeXmlnode node1 = Doc. createnode (xmlnodetype. element ,"Wsse: Nonce","Http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); Node1.prefix ="Wsse"; Node1.innertext = convert. tobase64string (system. Text. encoding. utf8.getbytes (system. datetime. Now. tostring ("Yyyy-mm-ddthh: mm: Ss. fffz")));// Add a created NodeXmlnode node2 = Doc. createnode (xmlnodetype. element ,"Wsu: created","Http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"); Node2.prefix ="Wsu"; Node2.innertext = datetime. utcnow. tostring ("Yyyy-mm-ddthh: mm: Ss. fffz");

As to where to add the information, the loadtokenfromxml method of usernametokenmanager is found in the Help File of Microsoft. Here, you can customize the soap information.

Second, let the Java client correct the transmitted soap Information


3. Other errors

Search for or improve yourself based on "Detailed" error information "and basic principles.

I encountered many problems during my work, but there were few solutions. Most of them were from foreigners, and there was no answer. It took a lot of time to find some information. To sum up, it is too careless to carefully read the error information or think about its related principles. Instead, it is simply relying on searching for information online, and the results are not satisfactory. Finally, I was able to look at the working mechanism of help and think about it, and then I found that I could do this.

It takes a long time to write because of laziness. Some things are forgotten, so it is easy to write and self-review. Record it first

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.