XFire

NPE when constructing SOAP header containing complex element (JAXB2 bindings)

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1.2, 1.2-RC
  • Fix Version/s: 1.2.1
  • Component/s: Core, JAXB 2.0
  • Labels:
    None
  • Environment:
    XFire 1.1.2 and 1.2-RC on WinXP SP2, JRE 1.5.0_06
  • Number of attachments :
    3

Description

Method invocation from client fails with NPE caused by MessagePartInfo.getSchemaType() returning null at AbstractBinding.java, line 252. Tried with both XFire 1.1.2 and 1.2-RC. It only happens when an invoked method contains arguments that go into header.

MessagePartInfo.setSchemaType(..) is invoked for the SessionInfo element (see method signature below) during client initialization, setting it to JaxbType.

Client classes are generated with xfire-maven-plugin wsgen task from WSDL file (server end runs MS dotNet 1.1), using JAXB2 bindings.

Relevant stack trade section:
-------------------------------------
java.lang.NullPointerException
at org.codehaus.xfire.service.binding.AbstractBinding.writeParameter(AbstractBinding.java:252)
at org.codehaus.xfire.service.binding.ServiceInvocationHandler.writeHeaders(ServiceInvocationHandler.java:315)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:73)
at org.codehaus.xfire.client.Client.invoke(Client.java:335)
at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
at $Proxy12.logout(Unknown Source)
-------------------------------------

Method signature:
-------------------------------------
@WebService(name = "MardukWSSoap", targetNamespace = "http://pivotcapital.com/Marduk/1.0")
public interface MardukWSSoap {
......
@WebMethod(operationName = "Logout", action = "http://pivotcapital.com/Marduk/1.0/Logout")
public void logout(
@WebParam(name = "SessionInfo", targetNamespace = "http://pivotcapital.com/Marduk/1.0", header = true)
com.pivotcapital.horus.marduk.xfire.schema.SessionInfo SessionInfo);
......
}
-------------------------------------

SessionInfo class:
-------------------------------------

/**

  • <p>Java class for SessionInfo complex type.
  • <p>The following schema fragment specifies the expected content contained within this class.
  • <pre>
  • <complexType name="SessionInfo">
  • <complexContent>
  • <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
  • <sequence>
  • <element name="sessionId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
  • </sequence>
  • </restriction>
  • </complexContent>
  • </complexType>
  • </pre>
  • */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "SessionInfo", propOrder = {
    "sessionId"
    })
    public class SessionInfo {

protected String sessionId;

public String getSessionId() { return sessionId; }

public void setSessionId(String value) { this.sessionId = value; }

}
-------------------------------------

  1. clientside.tar
    29/Aug/06 4:01 PM
    50 kB
    CYW
  2. README.TXT
    29/Aug/06 4:01 PM
    0.5 kB
    CYW
  3. serverside.tar
    29/Aug/06 4:01 PM
    50 kB
    CYW

Activity

Hide
Dan Diephouse added a comment -

This sounds like a configuration issue... Can you paste your client side configuration or how you created the client?

Show
Dan Diephouse added a comment - This sounds like a configuration issue... Can you paste your client side configuration or how you created the client?
Hide
Andrius Šabanas added a comment -

Client side code is generated from WSDL using a snapshot release of xfire-maven-plugin from mojo-sandbox that delegates the work to org.codehaus.xfire.gen.WsGenTask. Tthe plugin uses xfire-generator jar, version 1.1.1 (just noticed that, can the slightly older version cause this problem?).

I have also made one slight change to the plugin code, adding externalBindings configuration that is supported by Ant task. Here is the plugin config in my project POM:

-------------------------------------
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xfire-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>wsgen</goal>
</goals>
</execution>
</executions>
<configuration>
<package>com.pivotcapital.horus.marduk.xfire</package>
<binding>jaxb</binding>
<externalBindings>${project.basedir}/src/main/bindings/marduk-bindings.xjb</externalBindings>
<profile>org.codehaus.xfire.gen.jsr181.Jsr181Profile</profile>
<wsdls>
<wsdl>${project.basedir}/src/main/wsdl/MardukWS.wsdl</wsdl>
</wsdls>
</configuration>
</plugin>
-------------------------------------

The external bindings file:

-------------------------------------
<?xml version="1.0" encoding="UTF-8"?>

<jxb:bindings jxb:version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<jxb:bindings schemaLocation="../wsdl/MardukWS.wsdl#types?schema1" node="/xsd:schema">
<jxb:schemaBindings>
<jxb:package name="com.pivotcapital.horus.marduk.xfire.schema"></jxb:package>
</jxb:schemaBindings>
</jxb:bindings>
</jxb:bindings>
-------------------------------------

I does not matter whether I use the external bindings file - it does not work both ways.

Show
Andrius Šabanas added a comment - Client side code is generated from WSDL using a snapshot release of xfire-maven-plugin from mojo-sandbox that delegates the work to org.codehaus.xfire.gen.WsGenTask. Tthe plugin uses xfire-generator jar, version 1.1.1 (just noticed that, can the slightly older version cause this problem?). I have also made one slight change to the plugin code, adding externalBindings configuration that is supported by Ant task. Here is the plugin config in my project POM: ------------------------------------- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>xfire-maven-plugin</artifactId> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>wsgen</goal> </goals> </execution> </executions> <configuration> <package>com.pivotcapital.horus.marduk.xfire</package> <binding>jaxb</binding> <externalBindings>${project.basedir}/src/main/bindings/marduk-bindings.xjb</externalBindings> <profile>org.codehaus.xfire.gen.jsr181.Jsr181Profile</profile> <wsdls> <wsdl>${project.basedir}/src/main/wsdl/MardukWS.wsdl</wsdl> </wsdls> </configuration> </plugin> ------------------------------------- The external bindings file: ------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <jxb:bindings jxb:version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <jxb:bindings schemaLocation="../wsdl/MardukWS.wsdl#types?schema1" node="/xsd:schema"> <jxb:schemaBindings> <jxb:package name="com.pivotcapital.horus.marduk.xfire.schema"></jxb:package> </jxb:schemaBindings> </jxb:bindings> </jxb:bindings> ------------------------------------- I does not matter whether I use the external bindings file - it does not work both ways.
Hide
CYW added a comment -

I already emailed test example to the list, but just realized that this is the place to paste the files.

Show
CYW added a comment - I already emailed test example to the list, but just realized that this is the place to paste the files.
Hide
Dan Diephouse added a comment -

I've managed to reproduce this now. Looking into the fix.

Show
Dan Diephouse added a comment - I've managed to reproduce this now. Looking into the fix.
Hide
Dan Diephouse added a comment -

I've fixed this in SVN. Thanks for the example!!

Show
Dan Diephouse added a comment - I've fixed this in SVN. Thanks for the example!!

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: