I use a substring extracting input stream to remove soap junk. We specify the beginning and end strings to look for. The input stream only returns what is inside. We basically use the soap body tags or something in the payload as the beginnning and end.
This stream is placed in a chain that runs between the raw stream we get back from http client and what we pass to jibx. Other streams, such as those that can log to a file, are also chained up. The sub string extraction is also configured to throw an IO exception if it finds a configurable error string before what it has been instructed to let through. This way we can find out about soap faults and only bind to the payload. It's extremely fast and very easy to work with. To create s soap client using this technique, you specify a class that is jibx bound to the payload, the start and end tags, and a velocity template for the request (since we use velocity to create soap requests). For xml to objects we use jibx. For objects to xml we often use velocity. Aaron --- Andreas Schroeder <[EMAIL PROTECTED]> wrote: > Hi, > > I am new to jibx and I'd appreciate your help > guys. > > Can someone please post an example of how to map a > SOAP message > to Java? (without using jibxsoap since it has not > been released yet...) > > I want to avoid parsing the SOAP message twice, my > goal is to have jibx > do both in one parse: > 1) find out which SOAP request it is (login, > logout...etc) for the dispatcher. > 2) only create the Java object that correspond to > the message body content (i.e. if > login then LoginData.class will be initialized, > if Logout then LogoutData.class > will be initialized... etc..) > > It would be really useful if there are such > mapping example(s) on the website. > > As an example: > > <SOAP-ENV:Envelope > > xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' > > SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'> > <SOAP-ENV:Header> > <session-id>234234234</session-id> > </SOAP-ENV:Header> > <SOAP-ENV:Body> > <xyz:login xmlns="http://tempuri.org"> > <xyz:email-id>[EMAIL PROTECTED]</xyz:email-id> > <xyz:password>9999</xyz:password> > </xyz:login> > </SOAP-ENV:Body> > </SOAP-ENV:Envelope> > > I have been trying: > <binding> > <namespace prefix="SOAP-ENV" > uri="http://schemas.xmlsoap.org/soap/envelope/" > default="none" /> > <namespace prefix="xyz" > uri="http://www.op.com/schema/" default="none" /> > <mapping name="Envelope" class="SoapRequest"> > <value name="Envelope" field="_strEnv"/> > <value name="Header" field="_strHeader"/> > <structure name ="Body"> > <structure name ="login"> > <value name="email-id" field="_strEmail" /> > <value name="password" field="_strPassword" /> > </structure> > </structure> > </mapping> > </binding> > But I am getting the error: > org.jibx.runtime.JiBXException: No unmarshaller for > element > "{http://schemas.xmlsoap.org/soap/envelope/}Envelope" > (line > 2, col 61) > at > org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(Unknown > Source) > at > org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(Unknown > Source) > at JIBXTest.init(JIBXTest.java:23) > at JIBXTest.main(JIBXTest.java:43) > > My questions are: > 1) Regardless of the error I am getting, is this > even doable? > 2) Ideally I'd want to do the validation of the soap > against the schema to be done as well in the same > parse, too ambitious? (P.S. I am working on an > application with 140 TPS, so every ms counts...). > > Thanks in advance for your responses, > Andy > > > > --------------------------------- > Want to be your own boss? Learn how on Yahoo! Small > Business. > Using Tomcat but need to do more? Need to support > web services, security? > Get stuff done quickly with pre-integrated > technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 > based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > jibx-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/jibx-users > Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ jibx-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jibx-users
