This has to be a WSDL issue since that's the only thing I see could possibly be different aside from supporting jar differences (which doesn't seem very likely considering the error). Is there a way to get WSIF to spit out the WSDL it is consuming? I would very much like to compare what I am getting and what others are getting.
Peter
Anthony Elder wrote:
Hi Peter, thanks for zip I've just tried it and with some minor changes have got it working fine!
I'm not sure if its been clear that you do need to be using a recent WSIF build for this to work? Can you check you are using a recent WSIF build? There is a problem with this and WSIF 2.0, so you do need to use a WSIF jar from the nightly builds.
The testcase in the zip is still using the old factory.automaticallyMapTypes(true) method which has now changed to factory.setFeature( WSIFConstants.WSIF_FEATURE_AUTO_MAP_TYPES, new Boolean(true)), so you need to change that to work with a recent nightly build. (Hopefully we'll change this to be the default before the next WSIF release so you wont need it at all)
Thanks,
...ant
PS, we appreciate anyone who tries to use WSIF so you shouldn't worry about asking for help, its our failings that this is taking so long to resolve.
Anthony Elder [EMAIL PROTECTED] Web Services Development IBM UK Laboratories, Hursley Park (+44) 01962 818320, x248320, MP208.
"Peter G. Lane" <[EMAIL PROTECTED]> on 19/03/2003 21:42:21
Please respond to [EMAIL PROTECTED]
To: Nirmal Mukhi/Watson/[EMAIL PROTECTED] cc: [EMAIL PROTECTED] Subject: Re: DII code not working anymore/dynamic stub failing
Hi Nirmal,
Yes, this version of the example that Ant wrote is the exact code I am now testing with, and it does indeed cause the errors.
I've attached the directory tree that I've been working out of which contains, among other things, this test code and a readme.txt which explains how to test with it based on the Globus Tookit(r) 3.0 (lovingly refered to as just OGSA in most places). My goal was to make it as easy as possible for someone else to reproduce this stuff with our framework. I know I'm going crazy, so I certainly don't wish it upon anyone else. Please let me know if there's anything I can do in the meantime.
Anyway, thanks for all the help. I'm sure you all hate my guts by now.
Peter
Nirmal Mukhi wrote:
Hi Peter,
I tried out Ant's test below and so has Owen, we have all managed to get it to work without problems. Does it accurately capture what you are trying to do?
I will start looking at some of the Globus samples and try writing tests for them but in the meantime can you see if you see the problem with this test?
Thanks, Nirmal.
*"Anthony Elder" <[EMAIL PROTECTED]>*
03/11/2003 06:30 AM Please respond to wsif-dev
To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED] Subject: Re: DII code not working anymore/dynamic stub failing
I'm not really getting anywhere with this and don't have time to look at the globus samplse right now, so as there seemed to be lots a people here interested in this, maybe someone else has some time to look at the
samples
Peter points to at http://www.globus.org/ogsa/releases/alpha/
I've committed the testcase I use for this into defects.ogsa package.
Works
fine for me, so I'm not sure why it doesn't for Peter. Does it work for you?
...ant
Anthony Elder [EMAIL PROTECTED] Web Services Development IBM UK Laboratories, Hursley Park (+44) 01962 818320, x248320, MP208.
"Peter G. Lane" <[EMAIL PROTECTED]> on 07/03/2003 00:02:05
To: Anthony Elder/UK/[EMAIL PROTECTED] cc: Subject: Re: DII code not working anymore/dynamic stub failing
Hmmm, I don't know what to say. I substituted in your wsif.jar and massaged the test case so it would work with my package hierarchy and the new namespaces we just
changed
to, but I get the exact same error with the stub code. I am attaching my altered java file just
in
case I did something stupid.
Peter
P.S. If you're feeling curious and ambitious, you can download our software which contains all of our schemas and samples to test against: http://www.globus.org/ogsa/releases/alpha/.
Anthony Elder wrote: > Hi Peter, > > I hope you're not getting to put off of WSIF. I'm a bit confused
about
> which WSIF code you're running, and what patches I've already
committed
for > you. Here's the latest WSIF jar which includes the fixes from the previous > patches so I know exactly what you are running with. > > I've a test case based on the counter WSDL you initially sent and this > really does work ok for me. It needs to set the style in the context
for
> stubs, and for the getValue call with the DII. Hopefully I can get the stub > based calls to mostly work this out itself based on the types of the input > parts next week. With the getValue call where there are no input parts its > hard to tell what you really want so the context will still be
required,
> although a better default would be to use unwrapped, which I'll also change > next week. > > This wsif gives a SOAP request which looks more correct: > > <soapenv:Body> > <subtract xmlns > ="http://samples.ogsa.globus.org/counter/counter_port_type"> > <ns1:value xsi:type="xsd:int" xmlns:ns1 > ="http://samples.ogsa.globus.org/counter">9</ns1:value> > </subtract> > </soapenv:Body> > > Anyway, hopefully this will sort out all the trouble this has been causing > you, please let me know how you get on. > > > (See attached file: wsif.jar)(See attached file: > CounterServiceTestCase.java) > > ...ant > > Anthony Elder > [EMAIL PROTECTED] > Web Services Development > IBM UK Laboratories, Hursley Park > (+44) 01962 818320, x248320, MP208. > > > "Peter G. Lane" <[EMAIL PROTECTED]> on 05/03/2003 14:12:20 > > Please respond to [EMAIL PROTECTED] > > To: [EMAIL PROTECTED] > cc: > Subject: Re: DII code not working anymore/dynamic stub failing > > > > This doesn't seem to help either. I removed all code to manually
unwrap
> things, and added code to > check for wrapped style and to set the context part as you instructed right > before I get the stub. > I even tried setting this before I do an
executeRequestResponseOperation
() > (which I can get to > work), but that stops functioning too without the manual unwrapping. > > Peter > > > > Anthony Elder wrote: > >>Woh, deja vue. >> >>Hi Peter, >> >>Its not really clear why you are doing anything to do with unwrapping >>parts? WSIF should be doing all that for you under the covers for both > > the > >>stub and DII interface. Just make the WSIF call and WSIF should work
out
> > if > >>you're parameters match wrapped or unwrapped parts. There are a couple
of
>>circumstances where WSIF gets this wrong, I'm in the middle of trying
to
>>make this more robust. but for the moment sometimes you have to tell
WSIF
>>which to use. I think this is what's going wrong with you stub calls. >> >>You tell WSIF you want to use wrapped or unwrapped parts by setting a > > part > >>in the context method, for example this code should fix the stub
problem:
>> >> WSIFService service = >> factory.getService( >> "bin/ogsa/counter.wsdl", >> "http://samples.ogsa.globus.org/counter", >> "CounterService", >> "http://samples.ogsa.globus.org/counter/counter_port_type", >> "CounterPortType"); >> >> WSIFMessage ctx = service.getContext(); >> ctx.setObjectPart( >> WSIFConstants.CONTEXT_OPERATION_STYLE, >> WSIFConstants.CONTEXT_OPERATION_STYLE_WRAPPED); >> service.setContext(ctx); >> >> CounterPortType stub = >> (CounterPortType) service.getStub(portName,
CounterPortType.class);
>> >> >> ...ant >> >>Anthony Elder >>[EMAIL PROTECTED] >>Web Services Development >>IBM UK Laboratories, Hursley Park >>(+44) 01962 818320, x248320, MP208. >> >> >>"Peter G. Lane" <[EMAIL PROTECTED]> on 04/03/2003 18:46:21 >> >>Please respond to [EMAIL PROTECTED] >> >>To: [EMAIL PROTECTED] >>cc: >>Subject: DII code not working anymore/dynamic stub failing >> >> >> >>I'm having trouble with one of the latest nightly build jars. I had
DII
>>working last month, but recent changes seemed to have prevented
further
>>success. One thing I noticed is that unWrapPart() is deprecated. I'm
a
>>little nervous now about what I should be doing in lieu of that since
I
>>use getWrappedDocLiteralPart() which is not deprecated and implies I'd >>have to then unwrap it. It looks like this is causing problems with
the
org.apache.wsif.providers.ProviderUtils.getComplexType(ProviderUtils.java:389)>>DII method: >> >> [java] Exception in thread "main" java.lang.ClassCastException: >>org.apache.wsif.schema.ElementType >> [java] at >> > >
org.apache.wsif.providers.ProviderUtils.unWrapPart(ProviderUtils.java:343)> > >> [java] at >> > >
> >> [java] at >>org.apache.wsif.util.WSIFUtils.unWrapPart(WSIFUtils.java:1355) >> >> >>I'm also having trouble using getStub(). I get a proxy object which I >>verify is of the correct interface and has the correct methods using >>java.lang.reflect stuff, but I get an error saying that the method I'm >>trying to call from the stub was not found in the port type: >> >>... >> [java] 3185 [main] DEBUG >>org.globus.ogsa.client.wsif.samples.BasicCounterAdder - Method:
public
>>final int $Proxy0.add(int) throws java.rmi.RemoteException >>... >> [java] org.apache.wsif.WSIFException: Method add(int) was not >>found in portType
{http://ogsa.globus.org/samples/counter}CounterPortType
org.apache.wsif.base.WSIFClientProxy.findMatchingOperation(WSIFClientProxy.java:595)>> [java] at >> > >
org.globus.ogsa.client.wsif.samples.BasicCounterAdder.<init>(BasicCounterAdder.java:83)> > >> [java] at >>org.apache.wsif.base.WSIFClientProxy.invoke(WSIFClientProxy.java:244) >> [java] at $Proxy0.add(Unknown Source) >> [java] at >> > >
org.globus.ogsa.client.wsif.samples.BasicCounterAdder.main(BasicCounterAdder.java:101)> > >> [java] at >> > >
> > >> >> >>Thanks! >>Peter >> >> >> >> > > > >
/** * CounterServiceTestCase.java * * This file was auto-generated from WSDL * by the Apache WSIF WSDL2Java emitter. */
package org.globus.ogsa.client.wsif.test;
import java.rmi.RemoteException; import java.util.Iterator;
import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner;
import org.apache.wsif.WSIFConstants; import org.apache.wsif.WSIFException; import org.apache.wsif.WSIFMessage; import org.apache.wsif.WSIFOperation; import org.apache.wsif.WSIFPort; import org.apache.wsif.WSIFService; import org.apache.wsif.WSIFServiceFactory;
import org.globus.ogsa.samples.counter.CounterPortType;
public class CounterServiceTestCase extends TestCase {
private static final String HOST_BASE_URL = "http://127.0.0.1:8080/";
private static final String SAMPLES_BASE_PATH = "ogsa/services/samples/";
private static final String COUNTER_SERVICE_URL = HOST_BASE_URL + SAMPLES_BASE_PATH + "counter/basic/CounterFactoryService/myCounter";
private static final String WSDL_URL = COUNTER_SERVICE_URL + "?wsdl";
private static final String SERVICE_NS = "http://ogsa.globus.org/samples/counter/service"; private static final String SERVICE_NAME = "CounterService";
private static final String PORT_TYPE_NS = "http://ogsa.globus.org/samples/counter"; private static final String PORT_TYPE_NAME = "CounterPortType";
public CounterServiceTestCase(String name) { super(name); }
public static Test suite() { return new TestSuite(CounterServiceTestCase.class); }
protected void doit1DIICounterPortType(String portName) { try { WSIFServiceFactory factory = WSIFServiceFactory.newInstance(); factory.automaticallyMapTypes(true);
WSIFService service = factory.getService( this.WSDL_URL, SERVICE_NS, SERVICE_NAME, PORT_TYPE_NS, PORT_TYPE_NAME);
WSIFPort port = service.getPort(portName);
executeOpAdd(port); executeOpSubtract(port); executeOpGetValue(port);
} catch (Exception ex) { ex.printStackTrace(); } }
protected void executeOpAdd(WSIFPort wsifPort) throws WSIFException {
WSIFOperation op = wsifPort.createOperation("add");
WSIFMessage inMsg = op.createInputMessage(); WSIFMessage outMsg = op.createOutputMessage(); WSIFMessage faultMsg = op.createFaultMessage();
// TODO: change these params to required values int p0 = 5; inMsg.setIntPart("value", p0);
boolean success = op.executeRequestResponseOperation(inMsg, outMsg, faultMsg);
if (success) { System.out.println("operation 'add' successfull:"); for (Iterator i = outMsg.getPartNames(); i.hasNext();) { String partName = (String) i.next(); System.out.println(partName + ": " + outMsg.getObjectPart(partName)); } } else { System.err.println("operation 'add' returned a fault:"); for (Iterator i = faultMsg.getPartNames(); i.hasNext();) { System.err.println(faultMsg.getObjectPart((String) i.next ())); } } }
protected void executeOpSubtract(WSIFPort wsifPort) throws WSIFException {
WSIFOperation op = wsifPort.createOperation("subtract");
WSIFMessage inMsg = op.createInputMessage(); WSIFMessage outMsg = op.createOutputMessage(); WSIFMessage faultMsg = op.createFaultMessage();
// TODO: change these params to required values int p0 = 0; inMsg.setIntPart("value", p0);
boolean success = op.executeRequestResponseOperation(inMsg, outMsg, faultMsg);
if (success) { System.out.println("operation 'subtract' successfull:"); for (Iterator i = outMsg.getPartNames(); i.hasNext();) { String partName = (String) i.next(); System.out.println(partName + ": " + outMsg.getObjectPart(partName)); } } else { System.err.println("operation 'subtract' returned a fault:"); for (Iterator i = faultMsg.getPartNames(); i.hasNext();) { System.err.println(faultMsg.getObjectPart((String) i.next ())); } } }
protected void executeOpGetValue(WSIFPort wsifPort) throws WSIFException {
WSIFOperation op = wsifPort.createOperation("getValue");
WSIFMessage ctx = op.getContext(); ctx.setObjectPart( WSIFConstants.CONTEXT_OPERATION_STYLE, WSIFConstants.CONTEXT_OPERATION_STYLE_WRAPPED); op.setContext(ctx);
WSIFMessage inMsg = op.createInputMessage(); WSIFMessage outMsg = op.createOutputMessage(); WSIFMessage faultMsg = op.createFaultMessage();
// TODO: change these params to required values boolean success = op.executeRequestResponseOperation(inMsg, outMsg, faultMsg);
if (success) { System.out.println("operation 'getValue' successfull:"); for (Iterator i = outMsg.getPartNames(); i.hasNext();) { String partName = (String) i.next(); System.out.println(partName + ": " + outMsg.getObjectPart(partName)); } } else { System.err.println("operation 'getValue' returned a fault:"); for (Iterator i = faultMsg.getPartNames(); i.hasNext();) { System.err.println(faultMsg.getObjectPart((String) i.next ())); } } }
protected void doit2StubCounterPortType(String portName) { try { WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
WSIFService service = factory.getService( this.WSDL_URL, SERVICE_NS, SERVICE_NAME, PORT_TYPE_NS, PORT_TYPE_NAME);
WSIFMessage ctx = service.getContext(); ctx.setObjectPart( WSIFConstants.CONTEXT_OPERATION_STYLE, WSIFConstants.CONTEXT_OPERATION_STYLE_WRAPPED); service.setContext(ctx);
CounterPortType stub = (CounterPortType) service.getStub(portName, CounterPortType.class);
executeOpAdd(stub); executeOpSubtract(stub); executeOpGetValue(stub);
} catch (Exception ex) { ex.printStackTrace(); assertTrue("doit2StubCounterPortType got exception: " + ex.getLocalizedMessage(), false); } }
protected void executeOpAdd(CounterPortType stub) throws RemoteException {
// TODO: change these params to required values int p0 = 23;
int returnValue = stub.add(p0);
System.out.println("operation 'add' returned: " + returnValue); // assertTrue("operation add returned null!!", returnValue !=
null);
}
protected void executeOpSubtract(CounterPortType stub) throws RemoteException {
// TODO: change these params to required values int p0 = 42;
int returnValue = stub.subtract(p0);
System.out.println("operation 'subtract' returned: " + returnValue); // assertTrue("operation subtract returned null!!", returnValue != null); }
protected void executeOpGetValue(CounterPortType stub) throws RemoteException {
// TODO: change these params to required values
int returnValue = stub.getValue();
System.out.println("operation 'getValue' returned: " + returnValue); // assertTrue("operation getValue returned null!!", returnValue != null); }
public void testDoit1DIICounterPortTypeCounterPort() { doit1DIICounterPortType("CounterPort"); }
public void testDoit2StubCounterPortTypeCounterPort() { doit2StubCounterPortType("CounterPort"); }
public static void main(String[] args) { TestRunner.run(suite()); } }
