You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by rhwinzin <ra...@senacor.com> on 2010/05/11 23:29:26 UTC

Problem with javaType external binding

Hi,

I#M currently facing the following problem: I received a bunch of WSDLs
which I have to use in my application. Each of them contains a service an a
result structure (complexType). The result structures are the same for all
WSDLs, but since their java counterparts are generated into different
packages, it's a little hard to evaluate them in a generic way. As far as I
understood, changing the package for a complexType only is not possible. The
next idea was to apply a javaType binding instruction to those complex
types. But I just can't get it right. I tried jaxws binding, jaxb binding,
various xpath expressions - everything leading to errors or no result at
all. 

All the samples I found map a simpleType to some special java class (seems
that everyone wants to convert dates ...), but there was no sample for a
complexType. Maybe this does not work at all?

Though I never had the feeling, that I was even close to the solution, I'm
providing my latest binding file. Maybe it's at least a starting point for
hints:

<jaxws:bindings wsdlLocation="LastschriftZurueckgeben.wsdl"
          xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
          xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" jxb:version="1.0">

  <jaxws:bindings 
node="wsdl:definitions/wsdl:types/xsd:schema/xsd:complexType[@name='BcaStrChecklog']">
      <jxb:globalBindings>
        <jxb:javaType name="foo.bar.somType" xmlType="BcaStrChecklog"
                      parseMethod="methodOne"
                      printMethod="methodTwo"/>
      </jxb:globalBindings>
  </jaxws:bindings>
</jaxws:bindings>

BTW, there are two schemas in the WSDL - in case this might make a
difference.

Thanks in advance,
Ralph
-- 
View this message in context: http://old.nabble.com/Problem-with-javaType-external-binding-tp28529529p28529529.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Problem with javaType external binding

Posted by rhwinzin <ra...@senacor.com>.
Ok, so I know that I will have to use the class-mapping. Actually I got some
results using inline configuration, but still nothing using external binding
files. This is my binding-file:

<jaxws:bindings wsdlLocation="LastschriftZurueckgeben.wsdl"
          xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
          xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" jxb:version="1.0">

    <jaxws:bindings > 
        <jxb:bindings
node="//xsd:schema/xsd:complexType[@name='BcaStrChecklog']">
            <jxb:class implClass="foo.bar.SomeType"/>
        </jxb:bindings>
    </jaxws:bindings>
</jaxws:bindings>#

I somehow think the problem might be related to the fact, that there are two
schemas inside my WSDL (I left the inline configuration in comments):

    <wsdl:types>
        <xsd:schema attributeFormDefault="qualified"
targetNamespace="urn:sap-com:document:sap:rfc:functions">
            <xsd:simpleType name="char1">
                <xsd:restriction base="xsd:string">
                    <xsd:maxLength value="1"/>
                </xsd:restriction>
            </xsd:simpleType>
           ...
            <xsd:simpleType name="time">
                <xsd:restriction base="xsd:string">
                    <xsd:maxLength value="8"/>
                    <xsd:pattern value="\d\d:\d\d:\d\d"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:schema>
        <xsd:schema attributeFormDefault="qualified"
targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style"
                    xmlns:n0="urn:sap-com:document:sap:rfc:functions"
jxb:version="1.0">
            <xsd:import namespace="urn:sap-com:document:sap:rfc:functions"/>
            <xsd:complexType name="BcaStrChecklog">
                <!-- xsd:annotation>
                    <xsd:appinfo>
                        <jxb:class implClass="foo.bar.SomeType"/>
                    </xsd:appinfo>
                </xsd:annotation -->
                <xsd:sequence>
                    <xsd:element name="Type" type="n0:char1"/>
                    <xsd:element name="Id" type="n0:char20"/>
                    <xsd:element name="Number" type="n0:numeric3"/>
                    <xsd:element name="Message" type="n0:char220"/>
                    <xsd:element name="LogNo" type="n0:char20"/>
                    <xsd:element name="LogMsgNo" type="n0:numeric6"/>
                    <xsd:element name="MessageV1" type="n0:char50"/>
                    <xsd:element name="MessageV2" type="n0:char50"/>
                    <xsd:element name="MessageV3" type="n0:char50"/>
                    <xsd:element name="MessageV4" type="n0:char50"/>

I also tried to directly reference the schema by its namespace, but no
result either ...

BTW, is there _really good_ literature on this subject. Documentation in the
internet is not too comprehensive.

Bye,
Ralph
-- 
View this message in context: http://old.nabble.com/Problem-with-javaType-external-binding-tp28529529p28557276.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Problem with javaType external binding

Posted by Daniel Kulp <dk...@apache.org>.

The javaType thing in the globalBinding is for mapping simple types.   For 
other specific things, you would need the jaxb:class binding element.
    <jaxb:bindings node="//xs:schema/xs:complexType[@name='BcaStrChecklog']">
        <jaxb:class implClass="foo.bar.SomeType"/>
    </jaxb:bindings>

Dan


On Tuesday 11 May 2010 5:29:26 pm rhwinzin wrote:
> Hi,
> 
> I#M currently facing the following problem: I received a bunch of WSDLs
> which I have to use in my application. Each of them contains a service an a
> result structure (complexType). The result structures are the same for all
> WSDLs, but since their java counterparts are generated into different
> packages, it's a little hard to evaluate them in a generic way. As far as I
> understood, changing the package for a complexType only is not possible.
> The next idea was to apply a javaType binding instruction to those complex
> types. But I just can't get it right. I tried jaxws binding, jaxb binding,
> various xpath expressions - everything leading to errors or no result at
> all.
> 
> All the samples I found map a simpleType to some special java class (seems
> that everyone wants to convert dates ...), but there was no sample for a
> complexType. Maybe this does not work at all?
> 
> Though I never had the feeling, that I was even close to the solution, I'm
> providing my latest binding file. Maybe it's at least a starting point for
> hints:
> 
> <jaxws:bindings wsdlLocation="LastschriftZurueckgeben.wsdl"
>           xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
>           xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>           xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
>           xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" jxb:version="1.0">
> 
>   <jaxws:bindings
> node="wsdl:definitions/wsdl:types/xsd:schema/xsd:complexType[@name='BcaStrC
> hecklog']"> <jxb:globalBindings>
>         <jxb:javaType name="foo.bar.somType" xmlType="BcaStrChecklog"
>                       parseMethod="methodOne"
>                       printMethod="methodTwo"/>
>       </jxb:globalBindings>
>   </jaxws:bindings>
> </jaxws:bindings>
> 
> BTW, there are two schemas in the WSDL - in case this might make a
> difference.
> 
> Thanks in advance,
> Ralph

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog