Xfire to implement WebService related error logging __webservice

Source: Internet
Author: User
Tags wsdl

1. The client is presented with the following error message by calling a narrow interface implementation class method on the service side:

Org.codehaus.xfire.XFireRuntimeException:Could not invoke service. Nested exception is org.codehaus.xfire.fault.XFireFault:Fault:java.lang.NullPointerException

The above exception may occur in the following 2 situations, for example:

A. The client invokes the corresponding interface method of the server by implementing a narrow interface method to return the required data

List = Webservice.findinfobyob (ClassA a) where parameter A is a pure VO JavaBean type ClassA object, and service-side business interface implementation classes also have methods with the same name, including parameter types. However, the ClassA package path at the server side is not the same as the client, and the above error message appears.
Solution: Depending on the namespace in the WSDL, or the ClassA class that generates the same path on the client for the given package path name, the custom Java class that is returned for the business implementation class method should be the same as the client to generate the same package name on this convention.

B. The client invokes the corresponding interface method of the server by implementing a narrow interface method to return the required data

List = Webservice.findinfobyob (ClassA a);

In the FINDINFOBYOB (ClassA a) method, you need to access the method of the DAO layer, and you spell the where query condition by using the placeholder method,? A member variable of object A is used in the object array used, but the member variable is not assigned to the client. That is, the client passed the member variable value null,a is not a null object. At this point, the client invokes Webservice.findinfobyob (ClassA a), and the error exception information above appears.

Solution: Assign the initial value to the member variable of the A object that the server needs to use before calling list = Webservice.findinfobyob (ClassA a) on the client.

2. When the client implements a method of the narrow interface business implementation of the server, the method discovers that the result is not empty, but the result set returned to the client after the client business is NULL, but no error message is reported.

Solution: According to the namespace in the WSDL, or the package pathname given by the service, the client can generate the narrow interface interface with the same path and the same name, and the implementation class of the client narrow interface may not have to keep the same path as the namespace. However, the name and package path of the narrow interface must be maintained one to the server.

3. For the WebService client created through the Web application project, after writing the client calling program, the test class is found

Exception in thread "main" Java.lang.noclassdeffounderror:javax/xml/stream/xmlstreamreader

The solution is to check if your library is missing: jsr173_ Api-1.0.jar,stax-utils-20040917.jar,wstx-asl-2.9.3.jar,xmlparserapis-2.6.2.jar,xmlschema-1.0.3.jar these bags.

4. For the service-side narrow interface method, in the client only need to select their own methods to declare and implement it, but if the client's narrow interface declared in a service-side narrow interface defined methods, the following error occurs

Org.codehaus.xfire.XFireRuntimeException:Cannot Create mapping for java.util.List, unspecified component type for return type of method Findmailinfobycode in interface Com.cpst.project.service.IQueryMailService

Because a Findmailinfobycode method is declared in the narrow interface Iquerymailservice of the client, the method does not exist in the narrow interface iquerymailservice of the server, so the above exception occurs when initializing

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.