0

I'm tasked with making a Java client for an existing Axis2 1.5.1 webservice that we've been consuming using a c# client. We use byte arrays in a few locations most notably for the session handle and I'm running into an issue creating the stubs.

While the wsdl2c is creating a webservice stub that keeps the byte[] as byte[] the Java stubs are translating byte[] to DataHandler.

Is there a way to alter how wsdl2java does the mapping? Or am I missing something major here.

So right now I get byte[] -> xs:base64Binary -> DataHandler. What I want is byte[] -> xs:base64Binary -> byte[]

I've generated the stubs using wsdl2java using the -uw and -or arguments.

wsdl2java -uri http://mycomputer:myport/my-webservices/services/TheServices?wsdl -uw -or

The original java method looks like this

public byte[] newSession(byte[] domainenc, byte[] userenc, byte[] passenc) throws SOAPException {

The wsdl is as follows

<xs:element name="newSession">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="domainenc" nillable="true" type="xs:base64Binary"/>
<xs:element minOccurs="0" name="userenc" nillable="true" type="xs:base64Binary"/>
<xs:element minOccurs="0" name="passenc" nillable="true" type="xs:base64Binary"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="newSessionResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:base64Binary"/>
</xs:sequence>
</xs:complexType>
</xs:element>

For the C# client wsdl2C carried the parameter and returns types over as a byte[] which is how I want it

[return: System.Xml.Serialization.XmlElementAttribute("return", DataType="base64Binary", IsNullable=true)]
        public byte[] newSession([System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary", IsNullable=true)] byte[] domainenc, [System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary", IsNullable=true)] byte[] userenc, [System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary", IsNullable=true)] byte[] passenc) {
            object[] results = this.Invoke("newSession", new object[] {
                        domainenc,
                        userenc,
                        passenc});
            return ((byte[])(results[0]));
        }

However using wsdl2java it's translating the base64binary as a datahandler.

public  javax.activation.DataHandler newSession(javax.activation.DataHandler domainenc18,javax.activation.DataHandler userenc19,javax.activation.DataHandler passenc20) throws java.rmi.RemoteException

Any help is appreciated.

Matthew
  • 23
  • 1
  • 4

0 Answers0