Hi all,
I am a newbie to globus and I have modified the code of GT4IDE so
that it just generates the files necessary for deployment and then I used
globus-build-service to build the files and then deployed the service in
globus
The service got deployed properly.But when I tried to compile the
client code I got the following error:
[EMAIL PROTECTED] Math9Service]$ javac -classpath
./build/stubs/classes/:$CLASSPATH
org/globus/gt4ide/clients/Math9Service/Client.java
org/globus/gt4ide/clients/Math9Service/Client.java:27: add(
org.globus.gt4ide.Math9Service.stubs.Add) in
org.globus.gt4ide.Math9Service.stubs.Math9PortType cannot be applied to
(int)
math.add(10);
^
1 error
My client code is as follows
package org.globus.gt4ide.clients.Math9Service;
import org.apache.axis.message.addressing.Address;
import org.apache.axis.message.addressing.EndpointReferenceType;
import org.globus.gt4ide.Math9Service.stubs.Math9PortType;
//import org.globus.examples.stubs.MathService_instance.GetValueRP;
import
org.globus.gt4ide.Math9Service.stubs.service.Math9ServiceAddressingLocator;
public class Client {
public static void main(String[] args) {
Math9ServiceAddressingLocator locator = new
Math9ServiceAddressingLocator();
try {
String serviceURI = args[0];
// Create endpoint reference to service
EndpointReferenceType endpoint = new EndpointReferenceType();
endpoint.setAddress(new Address(serviceURI));
Math9PortType math = locator.getMath9PortTypePort(endpoint);
// Get PortType
math = locator.getMath9PortTypePort(endpoint);
// Perform an addition
math.add(10);
// Perform another addition
// math.add(5);
So I changed the parameter to add as :object of class Add
package org.globus.gt4ide.clients.Math9Service;
import org.apache.axis.message.addressing.Address;
import org.apache.axis.message.addressing.EndpointReferenceType;
import org.globus.gt4ide.Math9Service.stubs.Math9PortType;
//import org.globus.examples.stubs.MathService_instance.GetValueRP;
import
org.globus.gt4ide.Math9Service.stubs.service.Math9ServiceAddressingLocator;
import org.globus.gt4ide.Math9Service.stubs.Add;
public class Client {
public static void main(String[] args) {
Math9ServiceAddressingLocator locator = new
Math9ServiceAddressingLocator();
try {
String serviceURI = args[0];
Add addobj=new Add(10);
// Create endpoint reference to service
EndpointReferenceType endpoint = new EndpointReferenceType();
endpoint.setAddress(new Address(serviceURI));
Math9PortType math = locator.getMath9PortTypePort(endpoint);
// Get PortType
math = locator.getMath9PortTypePort(endpoint);
// Perform an addition
//math.add(10);
math.add(addobj);
// Perform another addition
// math.add(5);
the code for Add.java is as follows:
/**
* Add.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2RC2 Nov 14, 2006 (10:23:53 EST) WSDL2Java emitter.
*/
package org.globus.gt4ide.Math9Service.stubs;
public class Add implements java.io.Serializable {
private int arg1;
public Add() {
}
public Add(
int arg1) {
this.arg1 = arg1;
}
/**
* Gets the arg1 value for this Add.
*
* @return arg1
*/
public int getArg1() {
return arg1;
}
/**
* Sets the arg1 value for this Add.
*
* @param arg1
*/
public void setArg1(int arg1) {
this.arg1 = arg1;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof Add)) return false;
Add other = (Add) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
this.arg1 == other.getArg1();
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
_hashCode += getArg1();
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(Add.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("
http://www.globus.org/gt4ide/Math9Service", ">add"));
org.apache.axis.description.ElementDesc elemField = new
org.apache.axis.description.ElementDesc();
elemField.setFieldName("arg1");
elemField.setXmlName(new javax.xml.namespace.QName("", "arg1"));
elemField.setXmlType(new javax.xml.namespace.QName("
http://www.w3.org/2001/XMLSchema", "int"));
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
The client code now compiled but on running the client code I got the
following errors:
[EMAIL PROTECTED] Math9Service]$ java -classpath
./build/stubs/classes/:$CLASSPATH
org.globus.gt4ide.clients.Math9Service.Client
http://127.0.0.1:8080/wsrf/services/gt4ide/Math9Service
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a
child element, which is NOT expected, in something it was trying to
deserialize.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException:
SimpleDeserializer encountered a child element, which is NOT expected, in
something it was trying to deserialize.
at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(
SimpleDeserializer.java:144)
at org.apache.axis.encoding.DeserializationContext.startElement(
DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(
SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(
MessageElement.java:1140)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java
:238)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
at org.apache.axis.providers.java.RPCProvider.processMessage(
RPCProvider.java:148)
at org.apache.axis.providers.java.JavaProvider.invoke(
JavaProvider.java:319)
at org.apache.axis.strategies.InvocationStrategy.visit(
InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java
:450)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:285)
at org.globus.wsrf.container.ServiceThread.doPost(ServiceThread.java
:664)
at org.globus.wsrf.container.ServiceThread.process(
ServiceThread.java:382)
at org.globus.wsrf.container.ServiceThread.run(ServiceThread.java
:291)
{http://xml.apache.org/axis/}hostname:localhost.localdomain
org.xml.sax.SAXException: SimpleDeserializer encountered a child element,
which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.message.SOAPFaultBuilder.createFault(
SOAPFaultBuilder.java:221)
at org.apache.axis.message.SOAPFaultBuilder.endElement(
SOAPFaultBuilder.java:128)
at org.apache.axis.encoding.DeserializationContext.endElement(
DeserializationContext.java:1087)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
Source)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
at org.apache.axis.encoding.DeserializationContext.parse(
DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:645)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
at
org.apache.axis.message.addressing.handler.AddressingHandler.processClientResponse
(AddressingHandler.java:305)
at
org.apache.axis.message.addressing.handler.AddressingHandler.invoke(
AddressingHandler.java:110)
at org.apache.axis.strategies.InvocationStrategy.visit(
InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:190)
at org.apache.axis.client.Call.invokeEngine(Call.java:2727)
at org.apache.axis.client.Call.invoke(Call.java:2710)
at org.apache.axis.client.Call.invoke(Call.java:2386)
at org.apache.axis.client.Call.invoke(Call.java:2309)
at org.apache.axis.client.Call.invoke(Call.java:1766)
at
org.globus.gt4ide.Math9Service.stubs.bindings.Math9PortTypeSOAPBindingStub.add
(Math9PortTypeSOAPBindingStub.java:161)
at org.globus.gt4ide.clients.Math9Service.Client.main(Client.java
:30)
Part of Math9.WSDL is:
<!--BEGIN ELEMENT DEFINITIONS - DO NOT MODIFY THIS BLOCK!!! -->
<xsd:element name="add">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="arg1" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="addResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!--END ELEMENT DEFINITIONS -->
What is the error?Is the schema incorrect?Which arguments should be given
while invoking client code
Thanks for your help.