History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XFIRE-566
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dan Diephouse
Reporter: Andrius Šabanas
Votes: 1
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
XFire

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

Created: 03/Aug/06 09:31 AM   Updated: 05/Sep/06 03:14 PM
Component/s: Core, JAXB 2.0
Affects Version/s: 1.2-RC, 1.1.2
Fix Version/s: 1.2.1

Time Tracking:
Not Specified

File Attachments: 1. File clientside.tar (50 kb)
2. Text File README.TXT (0.5 kb)
3. File serverside.tar (50 kb)

Environment: XFire 1.1.2 and 1.2-RC on WinXP SP2, JRE 1.5.0_06


 Description  « Hide
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; }

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



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Dan Diephouse - 29/Aug/06 10:36 AM
This sounds like a configuration issue... Can you paste your client side configuration or how you created the client?

Andrius Šabanas - 29/Aug/06 11:31 AM
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.


CYW - 29/Aug/06 04:01 PM
I already emailed test example to the list, but just realized that this is the place to paste the files.

Dan Diephouse - 05/Sep/06 01:22 PM
I've managed to reproduce this now. Looking into the fix.

Dan Diephouse - 05/Sep/06 03:14 PM
I've fixed this in SVN. Thanks for the example!!