When WebServices is developed in Java, a message indicating parameter mismatch is displayed when pojo is passed.

Source: Internet
Author: User

When WebServices is developed in Java, a message indicating parameter mismatch is displayed when pojo is passed.

When the webservices service is developed in Java, there is no problem when the parameter is of the basic data type.

However, if a pojo is passed, that is, a java object, you may encounter a parameter mismatch problem.


After the webservices interface is exposed, it must be a wsdl file. Many articles on the Internet say, "When webservices transmits pojo, the system prompts that the parameters do not match, the solution is to put interfaces and pojo together. This is actually a representation"

This XML file does not appear to have any style information associated with it. The document tree is shown below.<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://d.c.b.a/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="TestwsImpl1Service" targetNamespace="http://d.c.b.a/"><wsdl:types><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://d.c.b.a/" elementFormDefault="unqualified" targetNamespace="http://d.c.b.a/" version="1.0"><xs:element name="updatePerson" type="tns:updatePerson"/><xs:element name="updatePersonResponse" type="tns:updatePersonResponse"/><xs:complexType name="updatePerson"><xs:sequence><xs:element minOccurs="0" name="arg0" type="tns:person"/></xs:sequence></xs:complexType><xs:complexType name="person"><xs:sequence><xs:element name="age" type="xs:int"/><xs:element minOccurs="0" name="name" type="xs:string"/></xs:sequence></xs:complexType><xs:complexType name="updatePersonResponse"><xs:sequence><xs:element minOccurs="0" name="return" type="tns:person"/></xs:sequence></xs:complexType></xs:schema></wsdl:types><wsdl:message name="updatePersonResponse"><wsdl:part element="tns:updatePersonResponse" name="parameters"></wsdl:part></wsdl:message><wsdl:message name="updatePerson"><wsdl:part element="tns:updatePerson" name="parameters"></wsdl:part></wsdl:message><wsdl:portType name="TestwsImpl1"><wsdl:operation name="updatePerson"><wsdl:input message="tns:updatePerson" name="updatePerson"></wsdl:input><wsdl:output message="tns:updatePersonResponse" name="updatePersonResponse"></wsdl:output></wsdl:operation></wsdl:portType><wsdl:binding name="TestwsImpl1ServiceSoapBinding" type="tns:TestwsImpl1"><soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="updatePerson"><soap:operation soapAction="" style="document"/><wsdl:input name="updatePerson"><soap:body use="literal"/></wsdl:input><wsdl:output name="updatePersonResponse"><soap:body use="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="TestwsImpl1Service"><wsdl:port binding="tns:TestwsImpl1ServiceSoapBinding" name="TestwsImpl1Port"><soap:address location="http://localhost:888/test1"/></wsdl:port></wsdl:service></wsdl:definitions>

The above is the wsdl file corresponding to a webservices interface I developed. In the file, my targetNamespace is
targetNamespace="http://d.c.b.a/"


That is to say, the person and targetNamespace on my webservices server are not the same path.


Bytes ------------------------------------------------------------------------------------------------------------------------


Let's develop a client program.



The person path of the client is the targetNamespace of the server.


In this case, pojo can be transferred.


Summary: The pojo path of the webservices server does not matter here. As long as the client's pojo package path corresponds to the targetNamespace In the wsdl file, it can be called through.


The conclusion that the client must put the pojo and interface declaration together is not correct.

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.