-----Ursprüngliche Nachricht-----
Von: Jürgen Bockhorn
Gesendet: Montag, 21. März 2011 10:30
An: [email protected]
Betreff: AW: AW: Problems to create a cxfbc:provider/consumer proxy
bridge
Hi,
as it seems that attachments don't work I past both WSDLs.
Original WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="wsdl-first"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tns="http://servicemix.apache.org/samples/wsdl-first"
xmlns:typens="http://servicemix.apache.org/samples/wsdl-
first/types"
targetNamespace="http://servicemix.apache.org/samples/wsdl-
first">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://servicemix.apache.org/samples/wsdl-
first/types"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
jaxb:version="2.0">
<xsd:annotation><xsd:appinfo>
<jaxb:schemaBindings>
<jaxb:package name="de.heuboe.simtd.tmm.jaxb"/>
</jaxb:schemaBindings>
</xsd:appinfo></xsd:annotation>
<xsd:include schemaLocation="person.xsd" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetPersonRequest">
<wsdl:part name="payload" element="typens:GetPerson"/>
</wsdl:message>
<wsdl:message name="GetPersonResponse">
<wsdl:part name="payload"
element="typens:GetPersonResponse"/>
</wsdl:message>
<wsdl:message name="UnknownPersonFault">
<wsdl:part name="payload"
element="typens:UnknownPersonFault"/>
</wsdl:message>
<wsdl:portType name="Person">
<wsdl:operation name="GetPerson">
<wsdl:input message="tns:GetPersonRequest"/>
<wsdl:output message="tns:GetPersonResponse"/>
<wsdl:fault name="UnknownPerson"
message="tns:UnknownPersonFault"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="PersonSOAPBinding" type="tns:Person">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetPerson">
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
<wsdl:fault name="UnknownPerson">
<soap:fault use="literal"
name="UnknownPerson" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="PersonService">
<wsdl:port binding="tns:PersonSOAPBinding" name="soap">
<soap:address location="http://localhost:8092/PersonService/
" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Included schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://servicemix.apache.org/samples/wsdl-
first/types"
xmlns:per="http://servicemix.apache.org/samples/wsdl-first/types"
xmlns:hb="http://ws.heuboe.de/base"
elementFormDefault="qualified">
<!-- import basic structures -->
<xsd:import
namespace="http://ws.heuboe.de/base"
schemaLocation="jhbWSBase.xsd"
/>
<xsd:element name="GetPerson">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="personId" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetPersonResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="personId" type="xsd:string"/>
<xsd:element name="ssn" type="xsd:string"/>
<xsd:element name="name" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="UnknownPersonFault">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="hb:ExceptionInfo" />
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Please see the import above !
And the Result:
<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="wsdl-
first"
targetNamespace="http://servicemix.apache.org/samples/wsdl-first"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://servicemix.apache.org/samples/wsdl-first"
xmlns:typens="http://servicemix.apache.org/samples/wsdl-first/types"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wsdl:types>
<xs:schema jaxb:version="2.0"
targetNamespace="http://servicemix.apache.org/samples/wsdl-first/types
"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://servicemix.apache.org/samples/wsdl-first"
xmlns:typens="http://servicemix.apache.org/samples/wsdl-first/types"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsd:annotation>
<xsd:appinfo>
<jaxb:schemaBindings>
<jaxb:package name="de.heuboe.simtd.tmm.jaxb"/>
</jaxb:schemaBindings>
</xsd:appinfo>
</xsd:annotation>
<!-- import basic structures -->
<xsd:element name="GetPerson">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="personId" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetPersonResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="personId" type="xsd:string"/>
<xsd:element name="ssn" type="xsd:string"/>
<xsd:element name="name" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="UnknownPersonFault">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="hb:ExceptionInfo"/>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xs:simpleType name="Identifier">
<xs:annotation>
<xs:documentation>
HB wide string id type to use in soap
web-
services
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:complexType name="ExceptionInfo">
<xs:annotation>
<xs:documentation>
HB wide exception type that should be
use in
a WS-Exception/Fault-element
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="errorType" type="xs:string">
<xs:annotation>
<xs:documentation>
Should be restricted
by a
derived object via
the fixed keyword to a
constant value that describes the type.
E.g.
fixed="DBException".
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="errorCode" type="xs:string">
<xs:annotation>
<xs:documentation>
Specification of the
(type) of
error.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0"
name="errorDescription"
type="xs:string">
<xs:annotation>
<xs:documentation>
Longer textual
description of
the error
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="GetPersonResponse">
<wsdl:part element="typens:GetPersonResponse" name="payload">
</wsdl:part>
</wsdl:message>
<wsdl:message name="GetPersonRequest">
<wsdl:part element="typens:GetPerson" name="payload">
</wsdl:part>
</wsdl:message>
<wsdl:message name="UnknownPersonFault">
<wsdl:part element="typens:UnknownPersonFault" name="payload">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="Person">
<wsdl:operation name="GetPerson">
<wsdl:input message="tns:GetPersonRequest">
</wsdl:input>
<wsdl:output message="tns:GetPersonResponse">
</wsdl:output>
<wsdl:fault message="tns:UnknownPersonFault"
name="UnknownPerson">
</wsdl:fault>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="PersonSOAPBinding" type="tns:Person">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetPerson">
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="UnknownPerson">
<soap:fault name="UnknownPerson" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="PersonService">
<wsdl:port binding="tns:PersonSOAPBinding" name="soap">
<soap:address location="http://localhost:9080/cfx-wsdl-first-
xsd-
war/services/PersonService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Please notice that the comment from the schema was taken into the
result.
But the schema 'jhbWSBase.xsd' imported by person.xsd was inlined.
The namespace of this schema was omitted, so that reference to it
in :
<xsd:element name="UnknownPersonFault">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="hb:ExceptionInfo"/>
</xsd:complexContent>
</xsd:complexType>
now is invalid.
Once again. This doesn't happen, if I deploy the provider and the
consumer
with two diffenent service assemblies.
Regards,
Jürgen
Von: Freeman Fang [mailto:[email protected]]
Gesendet: Montag, 21. März 2011 09:38
An: [email protected]
Betreff: Re: AW: Problems to create a cxfbc:provider/consumer proxy
bridge
On 2011-3-21, at 下午4:16, Jürgen Bockhorn wrote:
Hello Freeman,
thank you for you quick answer.
I've followed your advice, unfortunately with no success.
The result is the same. The example was developed from the cxf-
wsdl-
first example, that comes with the servicemix.
Changes are, that the schema is external and that the schema
imports
other schemas. We use imports excessifely to keep our data
structurs
modulare.
After deploying the cxfbc:consumer and the cxfbc:provider in one
SU,
the resulting WSDL ommits the includes and imports and the schema
is
inline.
The problem is, that the namespaces of the imported schemas are
gone
and therefor references to them are invalid.
Hi,
inline is expected behavior.
Did you use include instead?
The changed WSDL and the resulting WSDL (queried via the servicemix
consumer) are attached.
I can't see your attachment.
Freeman
Thanks in advance.
Jürgen
Von: Freeman Fang [mailto:[email protected]]
Gesendet: Montag, 21. März 2011 02:06
An: [email protected]
Betreff: Re: Problems to create a cxfbc:provider/consumer proxy
bridge
Hi,
My comment inline
On 2011-3-18, at 下午11:05, Jürgen Bockhorn wrote:
Hi,
I would like to configure a cxfbc:provider/cxfbc:consumer proxy
bridge to an external webservice.
The xbeans.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
xmlns:person="http://servicemix.apache.org/samples/wsdl-first">
<cxfbc:consumer wsdl="classpath:person.wsdl"
targetService="person:PersonService"
targetInterface="person:Person"
locationURI="http://0.0.0.0:8082/PS"
targetEndpoint="PSProxy"
/>
<cxfbc:provider wsdl="classpath:person.wsdl"
locationURI="http://localhost:9080/cfx-wsdl-first-xsd-war/
services
/P
er
sonService
"
service="person:PersonService"
interfaceName="person:Person"
endpoint="PSProxy"
/>
The WSDL imports XSDs to define the types instead of .
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3.org/2001/XMLSchema"
this is incorrect, the targetNamespace you used here should be the
namespace for this schema, it should be
http://servicemix.apache.org/samples/wsdl-first/types
if you adapt the wsdl from our person.wsdl.
the http://www.w3.org/2001/XMLSchema is from w3c and it's used for
the prefix like "xsd", you shouldn't use it as your customer
schema
namespace
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
jaxb:version="2.0">
<xsd:annotation><xsd:appinfo>
<jaxb:schemaBindings>
<jaxb:package name="de.heuboe.simtd.tmm.jaxb"/>
</jaxb:schemaBindings>
</xsd:appinfo></xsd:annotation>
<xsd:import
namespace="http://servicemix.apache.org/samples/wsdl-first/types
"
schemaLocation="person.xsd" />
This line is incorrect,
should use include but not import here, something like
<xsd:include schemaLocation="person.xsd"/> if the external schema
just use same namespace as the schame here you should be
include, I
suppose they both are
http://servicemix.apache.org/samples/wsdl-first/types
Freeman
</xsd:schema>
After deployment I can get the WSDL under
"http://localhost:8082/PS?wsdl . But a closer look reveals, that
the imports are replaced by the schema they contain with the
problem, that the namespaces are not longer correct.
<wsdl:types>
<xs:schema jaxb:version="2.0"
targetNamespace="http://www.w3.org/2001/XMLSchema
" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/
" xmlns:tns="http://servicemix.apache.org/samples/wsdl-first"
xmlns:typens="http://servicemix.apache.org/samples/wsdl-
first/types"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema
" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
">
<xsd:annotation>
<xsd:appinfo>
<jaxb:schemaBindings>
<jaxb:package name="de.heuboe.simtd.tmm.jaxb"/>
</jaxb:schemaBindings>
</xsd:appinfo>
</xsd:annotation>
<xsd:element name="GetPerson">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="personId" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetPersonResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="personId" type="xsd:string"/>
<xsd:element name="ssn" type="xsd:string"/>
<xsd:element name="name" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="UnknownPersonFault">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="hb:ExceptionInfo"/>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xs:simpleType name="Identifier">
<xs:annotation>
<xs:documentation>
HB wide string id type to use in
soap web-services
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:complexType name="ExceptionInfo">
<xs:annotation>
<xs:documentation>
HB wide exception type that should
be use in a WS-Exception/Fault-element
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="errorType"
type="xs:string">
<xs:annotation>
<xs:documentation>
Should be restricted
by a derived object via
the fixed keyword to
a constant value that describes the type.
E.g.
fixed="DBException".
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="errorCode"
type="xs:string">
<xs:annotation>
<xs:documentation>
Specification of the
(type) of error.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0"
name="errorDescription" type="xs:string">
<xs:annotation>
<xs:documentation>
Longer textual
description of the error
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
Is this a bug or do I need to set a certain property ?
BTW:
If you deploy the consumer and the provider in to seperate
service
assemblies the expected WSDL is returned.
If you just use to service units it seems, only the first will be
depoyed.
If you use more than one <xs:schema> element with the <xs:types>
element it won't work in any constalation, but if you call the
service directly everything is fine.
xbeans.xml, wsdl etc. are attached to this mail.
-----
Thanx in advance
Jürgen
<xbean.xml><person.xsd><jhbWSBase.xsd>
--
Freeman Fang
------------------------
FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang Apache
Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org Apache Felix:
http://felix.apache.org
--
Freeman Fang
------------------------
FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang Apache
Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org