On Wednesday 11 Aug 2004 17:50, Dennis Sosnoski wrote:
> You can't really work with an Integer in isolation, since you're
> probably not going to want to bind the java.lang.Integer class to a
> particular element name (might work for your very simple case, but will
> definitely cause problems for more complex ones).

I think what Axis does is uses the method parameter name from the java service 
implementation as the tag name.  I was kind of hoping to do that, so an 
addition service that took two integers would be called with

<addition>
  <param1>5</param1>
  <param2>10</param2>
</addition>

and I presume the WSDL will be able to expose this.  (I need to look into the 
WSDL stuff a bit more to understand it better.)

> I think the best way to handle things is with a class that represents
> the full data in a message (so corresponds to a top-level element in the
> XML, using doc/lit). You can define a binding for that class, which has
> an Integer component. On the client side, a stub method can populate an
> instance of that class with the data being passed as parameters, then
> hand it off to JibxSoap for marshalling. On the server side, JibxSoap
> would need to unwrap the object to an array of object references for the
> parameters, then pass those using reflection.

I was toying yesterday with having a SOAPCallParameters class, which 
implements IMarshallable and IUnmarshallable, and contains a Vector of 
IMarshallable instances.  This could then be passed to the call method as a 
single parameter, and would have the following implementation for marshall

  public void marshal(IMarshallingContext pCtx) throws JiBXException
  {
    Iterator lIterator = this.parameters.iterator();

    while (lIterator.hasNext())
    {
      IMarshallable lObject = (IMarshallable) lIterator.next();
      lObject.marshal(pCtx);
    }
  }

Will this work, or am I barking up the wrong conifer?

I was also considering a possible object in the Vector that contains a 
tagname/value pair, and also implements IMarshallable etc.  The caller of the 
service would have to add an instance of this object to the 
SOAPCallParameters class, containing the tag name and value for a simple data 
type parameter.  We could then marshall manually (hopefully!) and end up with 
the simple xml shown above.

> I'm working with Cameron on some related changes to JibxSoap and
> Xsd2Jibx now, though it'll probably still be a while before this whole
> technique is in place. Feel free to ask more questions if my answer
> above doesn't make sense. ;-)

Can you add me a little change in while you're changing jibx-soap?

In org.jibx.soap.server.SOAPServer, at around line 170, you do:

        Object response = method.invoke(null, args);

to run the method that the service is implemented in.

If you change it to the following, then it's possible to run non-static 
methods too:

                // if method is not static, we need an instance to pass to 
                // invoke method
                Object lInstance = null;
                if (!Modifier.isStatic(method.getModifiers()))
                {
                  // method we are calling is not static, create instance
                  lInstance = method.getDeclaringClass().newInstance();
                }

                Object response = method.invoke(lInstance, args);

ta.

I have permission to work on this stuff at the mo (though still waiting for it 
in writing) so hopefully I should be able to get it to work.

Tim.




-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
jibx-devs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to