Making our own WSDL is an option that I hadn't thought of. I'll give that a try. Thanks for the help.
-----Original Message----- From: Raymond Feng [mailto:[email protected]] Sent: Friday, September 04, 2009 11:50 To: [email protected] Subject: Re: Issue using JAXB generated classes in SCA remotable service Let us step back and try to understand what you want to achieve here. Here is my understanding: 1) You have a few XSDs and want to generate JAXB classes to represent them in Java 2) You use the generated JAXB classes for the your SCA java component and expose the service using binding.ws 3) Tuscany generates a WSDL from your service interface which uses JAXB classes 4) You have WS client that uses the WSDL to generate client code Why don't we just simply do the following way? 1) Create a WSDL that uses the XSDs 2) Run wsimport to generate JAX-WS and JAXB classes 3) Use the generated JAX-WS service endpoint interface as the SCA interface 4) Implement your SCA component 5) Configure the SCA component service using binidng.ws with @wsdlElement pointing to the WSDL service/port, binding or portType. This way, the WSDL will be derived from your original WSDL. Can you give a try while I'm further investigating the schema generation issue? Thanks, Raymond -------------------------------------------------- From: "Phillips, Chad" <[email protected]> Sent: Friday, September 04, 2009 10:33 AM To: <[email protected]> Subject: RE: Issue using JAXB generated classes in SCA remotable service > That schema that's using the xlink attributes is importing the xlink XSD. > However, the xlink XSD only contains attributes and attributeGroups so XJC > doesn't generate any classes from that schema (I assume that's expected). > I attached an updated test program to TUSCANY-3238 which reproduces the > problem; it includes the xlinks XSD used as well as a WSDL that generates > the same errors. > > -----Original Message----- > From: Raymond Feng [mailto:[email protected]] > Sent: Friday, September 04, 2009 09:33 > To: [email protected] > Subject: Re: Issue using JAXB generated classes in SCA remotable service > > It seems that JAXB Java to XSD generation expands things such as > attributeGroup or substitutionGroup. For example, > > <xs:attributeGroup ref="xlink:locatorLink"/> > > becomes: > >> <xs:attribute ref="ns3:type" >> xmlns:ns3="http://www.w3.org/1999/xlink"/> >> <xs:attribute ref="ns4:href" >> use="required" xmlns:ns4="http://www.w3.org/1999/xlink"/> >> <xs:attribute ref="ns5:role" >> xmlns:ns5="http://www.w3.org/1999/xlink"/> >> <xs:attribute ref="ns6:title" >> xmlns:ns6="http://www.w3.org/1999/xlink"/> >> <xs:attribute ref="ns7:label" >> xmlns:ns7="http://www.w3.org/1999/xlink"/> > > IMO, this is OK. The namespaces are correctly declared. Now it's a matter > of > how the xlink schema is referenced. Do you have xsd:import in your > original > schema to point to the xlink XSD? Do you have the generated JAXB classes > for > the xlink XSD? > > Thanks, > Raymond > > -------------------------------------------------- > From: "Phillips, Chad" <[email protected]> > Sent: Thursday, September 03, 2009 6:14 PM > To: <[email protected]> > Subject: RE: Issue using JAXB generated classes in SCA remotable service > >> Hi Raymond, >> >> I'm working w/ the fix for TUSCANY-3238 that you put on the 1.5.1 branch >> (r810694) but, wsimport is bombing out on the generated WSDL for my >> application's service. I'm still trying to isolate the problem and add >> it >> to the test program but, for now, here is some info on the problem. >> >> The original schema has this type: >> >> <xs:complexType name="RType"> >> <xs:sequence> >> <xs:element name="RR" minOccurs="0" maxOccurs="unbounded"> >> <xs:complexType> >> <xs:complexContent> >> <xs:extension base="SomeBaseType"> >> <xs:sequence> >> <xs:element name="link" maxOccurs="unbounded"> >> <xs:complexType> >> <xs:attributeGroup ref="xlink:locatorLink"/> >> </xs:complexType> >> </xs:element> >> </xs:sequence> >> </xs:extension> >> </xs:complexContent> >> </xs:complexType> >> </xs:element> >> </xs:sequence> >> <xs:attribute name="a" type="xs:anyURI" use="required" /> >> <!-- various attributes --> >> </xs:complexType> >> >> In the generated WSDL, the type definition looks like this: >> >> <xs:complexType name="RType"> >> <xs:sequence> >> <xs:element maxOccurs="unbounded" minOccurs="0" name="RR"> >> <xs:complexType> >> <xs:complexContent> >> <xs:extension base="tns:SomeBaseType"> >> <xs:sequence> >> <xs:element maxOccurs="unbounded" name="link"> >> <xs:complexType> >> <xs:sequence/> >> <xs:attribute ref="ns3:type" >> xmlns:ns3="http://www.w3.org/1999/xlink"/> >> <xs:attribute ref="ns4:href" >> use="required" xmlns:ns4="http://www.w3.org/1999/xlink"/> >> <xs:attribute ref="ns5:role" >> xmlns:ns5="http://www.w3.org/1999/xlink"/> >> <xs:attribute ref="ns6:title" >> xmlns:ns6="http://www.w3.org/1999/xlink"/> >> <xs:attribute ref="ns7:label" >> xmlns:ns7="http://www.w3.org/1999/xlink"/> >> </xs:complexType> >> </xs:element> >> </xs:sequence> >> </xs:extension> >> </xs:complexContent> >> </xs:complexType> >> </xs:element> >> </xs:sequence> >> <xs:attribute ref="tns:a" use="required"/> >> <!-- various attributes--> >> </xs:complexType> >> >> Here are the errors I'm getting: >> >> [ERROR] undefined attribute 'ns3:type' >> [ERROR] undefined attribute 'ns4:href' >> [ERROR] undefined attribute 'ns5:role' >> [ERROR] undefined attribute 'ns6:title' >> [ERROR] undefined attribute 'ns7:label' >> >> And there are some warnings for that type that may (or may not) be >> related >> to the issue: >> >> [wsimport] [WARNING] s4s-elt-invalid-content.1: The content of 'RType' is >> invalid. Element 'attribute' is invalid, misplaced, or occurs too often. >> >> [wsimport] [WARNING] src-resolve.4.2: Error resolving component >> 'ns3:type'. It was detected that 'ns3:type' is in namespace >> 'http://www.w3.org/1999/xlink', but components from this namespace are >> not >> referenceable from schema document 'file:/C:/test.wsdl#types?schema9'. If >> this is the incorrect namespace, perhaps the prefix of 'ns3:type' needs >> to >> be changed. If this is the correct namespace, then an appropriate >> 'import' >> tag should be added to 'file:/C:/test.wsdl#types?schema9'. >> >> [wsimport] [WARNING] s4s-elt-invalid-content.1: The content of >> '#AnonType_linkRRRType' is invalid. Element 'attribute' is invalid, >> misplaced, or occurs too often. >> >> -----Original Message----- >> From: Raymond Feng [mailto:[email protected]] >> Sent: Tuesday, September 01, 2009 16:36 >> To: [email protected] >> Subject: Re: Issue using JAXB generated classes in SCA remotable service >> >> Hi, >> >> Hmm, it seems to be an issue in JAXB. Now the only option is to add >> @XmlSeeAlso support for the interface as JAX-WS wsimport does. I'm trying >> it >> with the 2.x stream: >> >> @Remotable >> @XmlSeeAlso({abs.ObjectFactory.class, conc.ObjectFactory.class}) >> public interface TestService { >> >> public DataType getData(); >> >> } >> >> After fixing the j2w codegen, it produces the following wsdl. Can you try >> this WSDL to see if it works? Meanwhile, I'll try to port the fix into >> 1.x >> after more tests. >> >> >> <?xml version="1.0" encoding="UTF-8"?> >> <wsdl:definitions name="TestServiceService" >> targetNamespace="http://server.test/" xmlns:tns="http://server.test/" >> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" >> xmlns:xs="http://www.w3.org/2001/XMLSchema" >> xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/" >> xmlns:SOAP11="http://schemas.xmlsoap.org/wsdl/soap/"> >> <wsdl:types> >> <xs:schema elementFormDefault="qualified" targetNamespace="abs" >> version="1.0" xmlns:ns1="conc" xmlns:tns="abs" >> xmlns:xs="http://www.w3.org/2001/XMLSchema"> >> <xs:import namespace="conc"/> >> <xs:element name="IdentifierAbstract" type="xs:anyType"/> >> <xs:complexType name="DataType"><xs:choice><xs:element >> ref="tns:IdentifierAbstract"/><xs:element >> ref="ns1:Identifier"/></xs:choice></xs:complexType> >> </xs:schema> >> <xs:schema targetNamespace="conc" version="1.0" xmlns:ns1="abs" >> xmlns:tns="conc" xmlns:xs="http://www.w3.org/2001/XMLSchema"> >> <xs:import namespace="abs"/> >> <xs:element name="Identifier" type="tns:StringType"/> >> <xs:element name="TestData" type="ns1:DataType"/> >> <xs:simpleType name="StringType"><xs:restriction >> base="xs:string"/></xs:simpleType> >> </xs:schema> >> <xs:schema attributeFormDefault="qualified" >> elementFormDefault="unqualified" targetNamespace="http://server.test/" >> xmlns:ns0="abs" xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:import >> namespace="abs"/><xs:element >> name="getDataResponse"><xs:complexType><xs:sequence><xs:element >> minOccurs="0" name="return" nillable="true" >> type="ns0:DataType"/></xs:sequence></xs:complexType></xs:element><xs:element >> name="getData"><xs:complexType/></xs:element></xs:schema> >> </wsdl:types> >> <wsdl:message name="getDataResponse"> >> <wsdl:part name="getDataResponse" element="tns:getDataResponse"> >> </wsdl:part> >> </wsdl:message> >> <wsdl:message name="getData"> >> <wsdl:part name="getData" element="tns:getData"> >> </wsdl:part> >> </wsdl:message> >> <wsdl:portType name="TestService"> >> <wsdl:operation name="getData"> >> <wsdl:input message="tns:getData"> >> </wsdl:input> >> <wsdl:output message="tns:getDataResponse"> >> </wsdl:output> >> </wsdl:operation> >> </wsdl:portType> >> <wsdl:binding name="TestServiceBinding" type="tns:TestService"> >> <SOAP:binding style="document" >> transport="http://schemas.xmlsoap.org/soap/http"/> >> <wsdl:operation name="getData"> >> <SOAP:operation/> >> <wsdl:input> >> <SOAP:body use="literal"/> >> </wsdl:input> >> <wsdl:output> >> <SOAP:body use="literal"/> >> </wsdl:output> >> </wsdl:operation> >> </wsdl:binding> >> <wsdl:service name="TestServiceService"> >> <wsdl:port name="TestServicePort" binding="tns:TestServiceBinding"> >> <SOAP:address >> location="http://192.168.1.102:8080/TestServiceComponent/TestService"/> >> </wsdl:port> >> </wsdl:service> >> </wsdl:definitions> >> >> Thanks, >> Raymond >> >> -------------------------------------------------- >> From: "Phillips, Chad" <[email protected]> >> Sent: Tuesday, September 01, 2009 10:53 AM >> To: <[email protected]> >> Subject: RE: Issue using JAXB generated classes in SCA remotable service >> >>> Adding ObjectFactory to that annotation has the effect of creating a >>> complex type objectFactory in the WSDL: >>> >>> <xs:schema targetNamespace="conc" version="1.0"> >>> <xs:complexType name="objectFactory"> >>> <xs:sequence/> >>> </xs:complexType> >>> </xs:schema> >>> >>> -----Original Message----- >>> From: Raymond Feng [mailto:[email protected]] >>> Sent: Tuesday, September 01, 2009 10:18 >>> To: [email protected] >>> Subject: Re: Issue using JAXB generated classes in SCA remotable service >>> >>> Hi, >>> >>> I just came back from vacation to catch the discussion. >>> >>> Can you try to use @XmlSeeAlso to add the conc.ObjectFactory.class >>> instead >>> of conc.StringType.class? It seems that there is information in the >>> ObjectFactory.class to describe the element substitutionGroup. >>> >>> Thanks, >>> Raymond >>> -------------------------------------------------- >>> From: "Phillips, Chad" <[email protected]> >>> Sent: Tuesday, September 01, 2009 9:43 AM >>> To: <[email protected]> >>> Subject: RE: Issue using JAXB generated classes in SCA remotable service >>> >>>> The WSDL generated by Tuscany is missing the Identifier element that is >>>> present in the XSD used on the server side. Maybe I'm still missing an >>>> annotation? Here is the data on the server side before it's returned >>>> to >>>> the client: >>>> >>>> <DataType xmlns:ns2="conc" xmlns="abs"> >>>> <ns2:Identifier>FOO</ns2:Identifier> >>>> </DataType> >>>> >>>> And here is what the client receives: >>>> >>>> <DataType xmlns="abs"> >>>> <IdentifierAbstract xsi:nil="true" >>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/> >>>> </DataType> >>>> >>>> Some of the clients that will be using the WS are not under my control >>>> so >>>> they'll most likely not being using Tuscany to access the service (I >>>> believe most are using JAX-WS or Axis2). >>>> >>>> -----Original Message----- >>>> From: Scott Kurz [mailto:[email protected]] >>>> Sent: Tuesday, September 01, 2009 09:07 >>>> To: [email protected] >>>> Subject: Re: Issue using JAXB generated classes in SCA remotable >>>> service >>>> >>>> On Tue, Sep 1, 2009 at 11:33 AM, Phillips, Chad<[email protected]> >>>> wrote: >>>>> Anyone get a chance to look at this yet? It's a pretty major issue >>>>> for >>>>> my project as we can't return data in the required format. >>>> >>>> Chad, I'm not sure I'm totally following every step here... not sure >>>> what you mean by "...WSDL is not being generated correctly". I >>>> haven't actually run your app. >>>> >>>> But would you say that the service-side is sending back the correct >>>> XML, and you are having some problem on the client side? >>>> >>>> If so, I wonder if it would be useful to try using a Tuscany client w/ >>>> a reference with <binding.ws>? >>>> >>>> Scott >>> >>
