Mark,
You appear to be iterating over the names of the output parts and printing
out information about each name rather than the value for each part. Try:
if (successful)
{
Iterator outIter = output.getPartNames();
while (outIter.hasNext())
{
String nextName= (String) outIter.next();
nextObj = output.getObjectPart(nextName);
System.out.println(nextObj.getClass());
System.out.println(nextObj.toString());
}
}
Regards,
Owen
|---------+---------------------------->
| | <[EMAIL PROTECTED]|
| | cd.ie> |
| | |
| | 24/06/2003 12:31 |
| | Please respond to|
| | wsif-user |
| | |
|---------+---------------------------->
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
| To: <[EMAIL PROTECTED]>
|
| cc:
|
| Subject: [Complete Message] Incorrect part type returned
|
|
|
|
|
>--------------------------------------------------------------------------------------------------------------------------------------------------|
Sorry folks I hit send by accident when trying to format the message.
*************************************
Hi Folks,
I'm fairly new to WSIF but I created a WSIf client for a JBOSS
session bean. In the WSDL that describes the service it clearly indicates
that the type is that of xsd:double.
Therefore I was expecting the type of the object to be of type
java.lang.Double when I extracted it from the output message. Unfortunately
it is extracted as type java.lang.String.
WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
WSIFService wsifService =
factory.getService(wsdlLocation,serviceNS,serviceName,portTypeNS,
portTypeName);
WSIFPort wsifPort = wsifService.getPort(portTypeName);
WSIFOperation wsifOperation = wsifPort.createOperation(operation);
WSIFMessage input =wsifOperation.createInputMessage();
WSIFMessage output=wsifOperation.createOutputMessage();
WSIFMessage fault =wsifOperation.createFaultMessage();
input.setObjectPart("in0","0407114");
boolean successful =
wsifOperation.executeRequestResponseOperation(input,output,fault);
Object nextObj = null;
if (successful)
{
Iterator outIter = output.getPartNames();
while (outIter.hasNext())
{
nextObj= outIter.next();
System.out.println(nextObj.getClass());
System.out.println(nextObj.toString());
}
}
The result of this is that the class is java.lang.String and the object is
some decimal value which is correct except for the object type. I've tried
this in the past with plain DII apache soap with the following code and it
returned the result correctly.
**************************************************************
String endpoint = "http://localhost:8080/jboss-net/services/FPG"
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
setCallAttributes(call);
invokeServiceCall(call);
System.out.println("Call made to "+component_name+" service");
String methodName = "orderFPGTest";
call.setOperationName(methodName);
MessageContext ctx = call.getMessageContext();
Message msg = ctx.getRequestMessage();
System.out.println("The call looks like\n"+call.toString());
call.addParameter("name"
,org.apache.axis.Constants.XSD_STRING,ParameterMode.IN);
call.setReturnType(org.apache.axis.Constants.XSD_ANY);
Object res = call.invoke(new Object[] { "0407114" });
System.out.println("ClassType is " +res.getClass());
double result = ((Double)res).doubleValue();
**************************************************************
This produced an object of type java.lang.Double as opposed to
java.lang.String.
Here's the WSDL for the message.
- <wsdl:message name="orderFPGTestResponse">
<wsdl:part name="orderFPGTestReturn" type="xsd:double" />
</wsdl:message>
- <wsdl:message name="orderFPGTestRequest">
<wsdl:part name="in0" type="xsd:string" />
</wsdl:message>
Does anyone have any idea why this is happening that the WSIF is returning
a java.lang.String object and the regular apache soap API returns the
correct java.lang.Double?
Thanks,
Mark.
P.s. Apologies for the first message.