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/PersonService
"
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