You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by uh...@gmx.de on 2007/04/27 10:42:40 UTC
AXIS2 Code Generator ignores user defined namespace prefixes
Hello,
I have a small test WSDL (see below). I let AXIS2 Code Generator generate
classes by calling
@wsdl2java -uri foo.wsdl -o newfoo -p de.theservice.axis2 -ss -ssi -g
-t -sd -ns2p http://www.foo-bar.de/foo=de.theservice.axis2.foo
In the created ADB bean classes I find definition of QName
public static final javax.xml.namespace.QName MY_QNAME =
new javax.xml.namespace.QName("http://www.foo-bar.de/foo",
"CheckServiceRequest", "ns1");
replacing user defined namesspaceprefixes (in my example: "foo") with prefixes
like ns1, ns2, ... (in my example: "ns1")
When my client submits a "CheckService" request the service skeleton
implementation has to serialize the request object to a file.
public CheckServiceResponse CheckService(CheckServiceRequest request)
throws CheckServiceFaultMsgException {
OMOutputFormat omOutformat = new OMOutputFormat();
omOutformat.setCharSetEncoding(PrdGlobals.UTF_8);
OMDataSource omOutSource = request.getOMDataSource(
CreateProductSelTypRequest.MY_QNAME,
OMAbstractFactory.getOMFactory());
OutputStream outBeanStr = new FileOutputStream(someFile);
omOutSource.serialize(outBeanStr, omOutformat);
outBeanStr.close();
}
The output file "someFile" looks like
<ns1:CheckServiceRequest xmlns:ns1="http://www.foo-bar.de/foo">
<ns1:id>00004711</ns1:auftragsID>
<ns1:ergebnisURI>http://www.foo-bar.de:8181/TheService/download/result00004711.xml</ns1:ergebnisURI>
</ns1:CheckServiceRequest>
I use this output as input for a XSL Transformer. The problem now is, that
I therefor strictly need the original namespaceprefix "foo" instead of the
unknown "ns1", since there are dependencies of external xml schema defining
namespaceprefix "foo".
For the moment I find/replace all occurences of "ns1" by "foo", but this is
very annoying.
Is there a way to tell the code generator to use the original
namespaceprefixes?
If not (yet): is there a way to let OMDataSource change "ns1" back to "foo"
when serializing? Perhaps using a different QName object? I already tried
new QName("hhtp://www.foo-bar.de/foo", "CheckServiceRequest", "foo")
but it didn't change anything.
Any ideas? Wouldn't this be worth a JIRA?
Thanks, Ulf
----- WSDL -------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:foo="http://www.foo-bar.de/foo"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
name="TheService" targetNamespace="http://www.foo-bar.de/foo">
<wsdl:types>
<xs:schema targetNamespace="http://www.foo-bar.de/foo"
xmlns:foo="http://www.foo-bar.de/foo">
<xs:element name="CheckServiceRequest"
type="xs:string" />
<xs:element name="CheckServiceResponse"
type="foo:CheckServiceResponseType" />
<xs:element name="CheckServiceFault"
type="xs:string" />
<xs:complexType name="CheckServiceResponseType">
<xs:sequence>
<xs:element name="id"
type="xs:string" />
<xs:element name="resultURI"
type="xs:anyURI" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="CheckServiceRequest">
<wsdl:part element="foo:CheckServiceRequest"
name="CheckServiceRequest" />
</wsdl:message>
<wsdl:message name="CheckServiceResponse">
<wsdl:part element="foo:CheckServiceResponse"
name="CheckServiceResponse" />
</wsdl:message>
<wsdl:message name="CheckServiceFaultMsg">
<wsdl:part name="CheckServiceFault" element="foo:CheckServiceFault" />
</wsdl:message>
<wsdl:portType name="TheService">
<wsdl:operation name="CheckService">
<wsdl:input message="foo:CheckServiceRequest" />
<wsdl:output message="foo:CheckServiceResponse" />
<wsdl:fault name="CheckServiceFault"
message="foo:CheckServiceFaultMsg" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TheServiceSOAP" type="foo:TheService">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="CheckService">
<soap:operation soapAction="CheckService" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
<wsdl:fault name="CheckServiceFault">
<soap:fault name="CheckServiceFault" use="literal" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TheService">
<wsdl:port binding="foo:TheServiceSOAP" name="TheServiceSOAP">
<soap:address
location="http://www.foo-bar.de:8181/TheService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
--
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org