Hi,
I'm new to cxf, coming from xfire.
I'm using wsdl2java to generate the client for a WS. It works almost fine
(in the generated code one webmethod that has 3 params it's generated with
one, but I saw this is a bug).
The thing is I have this generated class:
package com.btsincusa.gp;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ExecTR element declaration.
*
* <p>The following schema fragment specifies the expected content contained
within this class.
*
* <pre>
* <element name="ExecTR">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="REQUEST"
type="{http://www.w3.org/2001/XMLSchema}anyType" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ExecTR")
@XmlRootElement
public class ExecTR {
protected Object request;
/**
* Gets the value of the request property.
*
* @return
* possible object is
* [EMAIL PROTECTED] Object }
*
*/
public Object getREQUEST() {
return request;
}
/**
* Sets the value of the request property.
*
* @param value
* allowed object is
* [EMAIL PROTECTED] Object }
*
*/
public void setREQUEST(Object value) {
this.request = value;
}
}
This REQUEST object I've created:
package com.btsincusa.gp;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
/**
* <p>
* Java class for ADDRESSING complex type.
*
* <p>
* The following schema fragment specifies the expected content contained
within
* this class.
*
* <pre>
* <complexType name="ADDRESSING">
* <complexContent>
* <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="FROM"
type="{http://www.w3.org/2001/XMLSchema}string"
minOccurs="0"/>
* <element name="TO"
type="{http://www.w3.org/2001/XMLSchema}string"
minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "REQUEST", propOrder = { "AGENT_CD", "AGENT_TRANS_TYPE_CODE"
})
public class REQUEST {
@XmlElement(name = "AGENT_CD")
protected String AGENT_CD;
@XmlElement(name = "AGENT_TRANS_TYPE_CODE")
protected String AGENT_TRANS_TYPE_CODE;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new
HashMap<QName, String>();
/**
* Gets the value of the AGENT_CD property.
*
* @return possible object is [EMAIL PROTECTED] String }
*
*/
public String getAGENT_CD() {
return AGENT_CD;
}
/**
* Sets the value of the AGENT_CD property.
*
* @param value
* allowed object is [EMAIL PROTECTED] String }
*
*/
public void setAGENT_CD(String value) {
this.AGENT_CD = value;
}
/**
* Gets the value of the AGENT_TRANS_TYPE_CODE property.
*
* @return possible object is [EMAIL PROTECTED] String }
*
*/
public String getAGENT_TRANS_TYPE_CODE() {
return AGENT_TRANS_TYPE_CODE;
}
/**
* Sets the value of the AGENT_TRANS_TYPE_CODE property.
*
* @param value
* allowed object is [EMAIL PROTECTED] String }
*
*/
public void setAGENT_TRANS_TYPE_CODE(String value) {
this.AGENT_TRANS_TYPE_CODE = value;
}
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}
And this WSDL:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://www.btsincusa.com/gp/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://www.btsincusa.com/gp/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified"
targetNamespace="http://www.btsincusa.com/gp/">
<s:element name="GetData">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="REQUEST" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetDataResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetDataResult">
<s:complexType mixed="true">
<s:sequence>
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="ADDRESSING" type="tns:ADDRESSING" />
<s:complexType name="ADDRESSING">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="FROM" type="s:string"
/>
<s:element minOccurs="0" maxOccurs="1" name="TO" type="s:string"
/>
</s:sequence>
<s:anyAttribute />
</s:complexType>
<s:element name="SECURITY" type="tns:SECURITY" />
<s:complexType name="SECURITY">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="SESSION_ID"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="USER_NAME"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="USER_DOMAIN"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="USER_PASS"
type="s:string" />
</s:sequence>
<s:anyAttribute />
</s:complexType>
<s:element name="ExecTR">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="REQUEST" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="ExecTRResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ExecTRResult">
<s:complexType mixed="true">
<s:sequence>
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="GetDataSoapIn">
<wsdl:part name="parameters" element="tns:GetData" />
</wsdl:message>
<wsdl:message name="GetDataSoapOut">
<wsdl:part name="parameters" element="tns:GetDataResponse" />
</wsdl:message>
<wsdl:message name="GetDataADDRESSING">
<wsdl:part name="ADDRESSING" element="tns:ADDRESSING" />
</wsdl:message>
<wsdl:message name="GetDataSECURITY">
<wsdl:part name="SECURITY" element="tns:SECURITY" />
</wsdl:message>
<wsdl:message name="ExecTRSoapIn">
<wsdl:part name="parameters" element="tns:ExecTR" />
</wsdl:message>
<wsdl:message name="ExecTRSoapOut">
<wsdl:part name="parameters" element="tns:ExecTRResponse" />
</wsdl:message>
<wsdl:message name="ExecTRADDRESSING">
<wsdl:part name="ADDRESSING" element="tns:ADDRESSING" />
</wsdl:message>
<wsdl:message name="ExecTRSECURITY">
<wsdl:part name="SECURITY" element="tns:SECURITY" />
</wsdl:message>
<wsdl:portType name="TransactionServiceSoap">
<wsdl:operation name="GetData">
<wsdl:input message="tns:GetDataSoapIn" />
<wsdl:output message="tns:GetDataSoapOut" />
</wsdl:operation>
<wsdl:operation name="ExecTR">
<wsdl:input message="tns:ExecTRSoapIn" />
<wsdl:output message="tns:ExecTRSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TransactionServiceSoap"
type="tns:TransactionServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetData">
<soap:operation soapAction="http://www.btsincusa.com/gp/GetData"
style="document" />
<wsdl:input>
<soap:body use="literal" />
<soap:header message="tns:GetDataADDRESSING" part="ADDRESSING"
use="literal" />
<soap:header message="tns:GetDataSECURITY" part="SECURITY"
use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="ExecTR">
<soap:operation soapAction="http://www.btsincusa.com/gp/ExecTR"
style="document" />
<wsdl:input>
<soap:body use="literal" />
<soap:header message="tns:ExecTRADDRESSING" part="ADDRESSING"
use="literal" />
<soap:header message="tns:ExecTRSECURITY" part="SECURITY"
use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="TransactionServiceSoap12"
type="tns:TransactionServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetData">
<soap12:operation soapAction="http://www.btsincusa.com/gp/GetData"
style="document" />
<wsdl:input>
<soap12:body use="literal" />
<soap12:header message="tns:GetDataADDRESSING" part="ADDRESSING"
use="literal" />
<soap12:header message="tns:GetDataSECURITY" part="SECURITY"
use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="ExecTR">
<soap12:operation soapAction="http://www.btsincusa.com/gp/ExecTR"
style="document" />
<wsdl:input>
<soap12:body use="literal" />
<soap12:header message="tns:ExecTRADDRESSING" part="ADDRESSING"
use="literal" />
<soap12:header message="tns:ExecTRSECURITY" part="SECURITY"
use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TransactionService">
<wsdl:port name="TransactionServiceSoap"
binding="tns:TransactionServiceSoap">
<soap:address
location="http://test.globalplatform.ws/dv/gpcs/gpts/transactionservice.asmx
" />
</wsdl:port>
<wsdl:port name="TransactionServiceSoap12"
binding="tns:TransactionServiceSoap12">
<soap12:address
location="http://test.globalplatform.ws/dv/gpcs/gpts/transactionservice.asmx
" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I set a REQUEST object to a ExecTR object and then I run the service, I get
this SOAP request:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ns2:ADDRESSING xmlns:ns2="http://www.btsincusa.com/gp/">
<ns2:FROM></ns2:FROM>
<ns2:TO></ns2:TO>
</ns2:ADDRESSING>
<ns2:SECURITY xmlns:ns2="http://www.btsincusa.com/gp/">
<ns2:SESSION_ID></ns2:SESSION_ID>
<ns2:USER_NAME>xx</ns2:USER_NAME>
<ns2:USER_DOMAIN>xx</ns2:USER_DOMAIN>
<ns2:USER_PASS>xx</ns2:USER_PASS>
</ns2:SECURITY>
</soap:Header>
<soap:Body>
<ns2:ExecTR xmlns:ns2="http://www.btsincusa.com/gp/">
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="ns2:ExecTR">
<request xsi:type="ns2:REQUEST">
<AGENT_CD>KIO</AGENT_CD>
<AGENT_TRANS_TYPE_CODE>JUHK</AGENT_TRANS_TYPE_CODE>
</request>
</request>
</ns2:ExecTR>
</soap:Body>
</soap:Envelope>
And what I need to be generated is this:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ns2:ADDRESSING xmlns:ns2="http://www.btsincusa.com/gp/">
<ns2:FROM></ns2:FROM>
<ns2:TO></ns2:TO>
</ns2:ADDRESSING>
<ns2:SECURITY xmlns:ns2="http://www.btsincusa.com/gp/">
<ns2:SESSION_ID></ns2:SESSION_ID>
<ns2:USER_NAME>xx</ns2:USER_NAME>
<ns2:USER_DOMAIN>xx</ns2:USER_DOMAIN>
<ns2:USER_PASS>xx</ns2:USER_PASS>
</ns2:SECURITY>
</soap:Header>
<soap:Body>
<ns2:ExecTR xmlns:ns2="http://www.btsincusa.com/gp/">
<ns2:request xmlns:ns2="http://www.btsincusa.com/gp/">
<AGENT_CD>KIO</AGENT_CD>
<AGENT_TRANS_TYPE_CODE>JUHK</AGENT_TRANS_TYPE_CODE>
</ns2:request>
</ns2:ExecTR>
</soap:Body>
</soap:Envelope>
I will appreciate any ideas about this
Thanks in advance
--
Alejandro Raiczyk
Software Architect
Technisys
Banking on SOA
Miami +1 305 357 8109
Madrid +34 915 726 763
Buenos Aires +54 11 43227100
Tandil: +54 2293 444778