Hi,
I think you instantiate the service factory by simply doing
"new JibxServiceFactory()". That works in my app. Maybe it has to be
different if you are using a different transport?
Unfortunately, I haven't tried getting XFire to generate a WSDL with my
schemas. Instead, I generated the WSDL without the <types> populated, and then
copied/pasted the schemas I got from JiBX Schema generator. Then I configured
services.xml to point to this static WSDL file. I'm not sure what your
architecture is, but generally I would think you dont want your WSDL to be
code-generated. It's supposed to be a fixed contract between the client and the
server. You dont want it to change if you upgrade XFire for example. So I would
just create a static file and point to it. Hope this helps.
Andrey
Javier Diaz <[EMAIL PROTECTED]> wrote:
v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);}
st1\:*{behavior:url(#default#ieooui) } Hi Andrey
Sorry to bother you again, but Im still having problems. As I mentioned to
you yesterday we managed to get the schema generator working, when we changed
back to jibx_1.1. Now when we try to get the wsdl we got the following error:
HTTP ERROR: 500
org/jaxen/BaseXPath
RequestURI=/Availability
Powered by Jetty://
Ive been looking for a code sample about how to associate the xsd schema and
I couldnt find one, so Im not sure if what Im doing is correct or not. See
below:
ObjectServiceFactory factory = new ObjectServiceFactory(new
AegisBindingProvider(new JibxTypeRegistry()));
//-- I ALSO TRY USING ---------------
// XFire xfire = XFireFactory.newInstance().getXFire();
// ObjectServiceFactory factory = new
JibxServiceFactory(xfire.getTransportManager());
// AND I GOT SAME ERROR ---------------------------
ArrayList schemas = new ArrayList();
HashMap properties = new HashMap();
schemas.add("binding.xsd");
properties.put(ObjectServiceFactory.SCHEMAS, schemas);
factory.setWsdlBuilderFactory(new DefaultWSDLBuilderFactory());
Service availabilityService = factory.create(Availability.class,
"Availability", "http://localhost:8080/Availability", properties);
xfire.getServiceRegistry().register(availabilityService);
availabilityService.setProperty(ObjectInvoker.SERVICE_IMPL_CLASS,
AvailabilityImpl.class);
logger.debug("Starting Server");
// Start the HTTP server
server = new XFireHttpServer();
server.setPort(8080);
server.start();
This is the bindind.xsd which was generated:
<?xml version="1.0" encoding="UTF-8"?><schema
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<!-- Created from mapping for class
com.sconnector.api.availability.AvailabilityRequest -->
<element name="AvailReq">
<complexType>
<sequence>
<element minOccurs="0" name="dep" type="xsd:string"/>
<element minOccurs="0" name="des" type="xsd:string"/>
</sequence>
</complexType>
</element>
<!-- Created from mapping for class
com.sconnector.api.availability.AvailabilityResponse -->
<element name="AvailResp">
<complexType>
<sequence>
<element minOccurs="0" name="result" type="xsd:string"/>
<element minOccurs="0" name="num-fares" type="xsd:int"/>
</sequence>
</complexType>
</element>
</schema>
If you could tell me what is wrong or what is the right why to associate the
.xsd to Xfire I will really appreciated.
Thx a lot
Javier
---------------------------------
From: Javier Diaz
Sent: 26 March 2007 13:27
To: '[EMAIL PROTECTED]'; '[email protected]'
Subject: RE: [xfire-user] Xfire - Jibx
Hi Andrey
Thanks a lot for your answer. We are trying now to generate the xsd schema
using the schema generator from jibx, but were getting some errors. I already
post an email to the jibx list, to see someone can help us. Nevertheless below
is the problem we are having; just in case you could know what could be
happening.
binding.xml
<?xml version="1.0" encoding="UTF-8"?>
<binding forwards="false" value-style="attribute">
<mapping
class="com.lastminute.sconnector.api.availability.AvailabilityRequest"
name="AvailReq">
<value style="element" name="dep" set-method="setDEP" get-method="getDEP"
usage="optional"/>
<value style="element" name="des" set-method="setDES" get-method="getDES"
usage="optional"/>
</mapping>
<mapping
class="com.lastminute.sconnector.api.availability.AvailabilityResponse"
name="AvailResp">
<value style="element" name="result" set-method="setResult"
get-method="getResult" usage="optional"/>
<value style="element" name="num-fares" set-method="setNumFares"
get-method="getNumFares" usage="optional"/>
</mapping>
</binding>
Error trying to generate the schema:
java -jar
/home/jdiaz/p4/project/cppLFE/main/SConnector/lib/jibx/jibx-genschema.jar
binding.xml
Running schema generator version 0.2
Error: Non-abstract mapping must define an element name; on mapping element
at (line 3, col 99, in binding_xml)
Error: Class name is required; on mapping element at (line 3, col 99, in
binding_xml)
Error: Non-abstract mapping must define an element name; on mapping element
at (line 7, col 101, in binding_xml)
Error: Class name is required; on mapping element at (line 7, col 101, in
binding_xml)
It looks to us that we are clear defining a name for both mapping elements,
so we are not sure where the problem lies.
Thx
Javier
---------------------------------
From: Andrey Utis [mailto:[EMAIL PROTECTED]
Sent: 23 March 2007 18:28
To: [email protected]
Subject: Re: [xfire-user] Xfire - Jibx
I've run into a similar problem when I was setting up my web services. I
dont think xfire can generate a schema from JiBX mappings. Even JiBX
distribution itself admits that the schema generator it comes with has a number
of limitations. So what I did to get around this was very simple: I compiled my
schema manually (using JiBX schema compiler) and then copy/pasted them into the
WSDL and published that WSDL in XFire. It works without any problems.
Andrey
Javier Diaz <[EMAIL PROTECTED]> wrote:
Hi guys
We are new to Xfire. We have are trying to use Xfire-Jibx with a very
simple application but we are having problems generating the WSDL. Basically we
have two simple classes, with just two fields each:
public class AvailabilityRequest {
public String DEP;
public String DES;
//
. Getter and Setters here
..
}
public class AvailabilityResponse {
public String result;
public int numFares;
//
Getters and Setters here
}
This is our code to run the XFire server
.
XFire xfire = XFireFactory.newInstance().getXFire();
ServiceFactory factory = new
JibxServiceFactory(xfire.getTransportManager());
Service availabilityService = factory.create(Availability.class,
"Availability", "http://localhost:8080/Availability", null);
xfire.getServiceRegistry().register(availabilityService);
availabilityService.setProperty(ObjectInvoker.SERVICE_IMPL_CLASS,
AvailabilityImpl.class);
logger.debug("Starting Server");
// Start the HTTP server
server = new XFireHttpServer();
server.setPort(8080);
server.start();
Our binding.xml
-------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<binding forwards="false" value-style="attribute">
<mapping name="AvailReq"
class="com.lastminute.sconnector.api.availability.AvailabilityRequest">
<value style="element" name="dep" field="DEP" usage="optional"/>
<value style="element" name="des" field="DES" usage="optional"/>
</mapping>
<mapping name="AvailResp"
class="com.lastminute.sconnector.api.availability.AvailabilityResponse">
<value style="element" name="result" field="result" usage="optional"/>
<value style="element" name="num-fares" field="numFares"/>
</mapping>
</binding>
Everything is compiling correct and we manage to get the server running,
however if we try to get the WSDL, only the root elements are being generated,
we are missing the rest of the fields in our classes, see below:
<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://localhost:8080/Availability"
xmlns:tns="http://localhost:8080/Availability"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"
xmlns:ns1="http://com.lastminute.sconnector.api.availability.AvailabilityRequest"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding"
xmlns:ns2="http://com.lastminute.sconnector.api.availability.AvailabilityResponse"
xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://localhost:8080/Availability">
- <xsd:element name="getAvailability">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" ref="ns1:AvailReq" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="getAvailabilityResponse">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" ref="ns2:AvailResp" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
We believe we are really missing something, but we dont really dont know.
Any help will be really appreciated.
Thx
Javier
---------------------------------
We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.
---------------------------------
We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.