You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Abhishek Verma <Ab...@symantec.com> on 2007/04/09 14:19:55 UTC
unable to call webservice
Subject:
Hi
I have a web service which generate the SSL keys for the given user
I have written the client code to access service but it fails..
Can any body help me..
CLIENT CODE
*********************
import java.io.FileReader;
import java.io.IOException;
import javax.xml.namespace.QName;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;
public class RPCClass {
static private String readInput(String filename)
throws java.io.IOException
{
StringBuffer sbuf = new StringBuffer();
FileReader in = new FileReader( filename );
int len;
char cbuf[] = new char[512];
while ((len = in.read( cbuf, 0, cbuf.length)) != -1) {
sbuf.append( cbuf, 0, len );
}
in.close();
return sbuf.toString();
}
public static void main(String[] args1) throws AxisFault {
RPCServiceClient serviceClient = new
RPCServiceClient();
Options options = serviceClient.getOptions();
EndpointReference targetEPR =
new
EndpointReference("http://127.0.0.1:8080/axis2/services/Keygen");
options.setTo(targetEPR);
QName opgenerateKey= new
QName("http://keygen.symantec.com/xsd","generateKey");
String method="SIG";
String xmlfile="E:/WorkSpace/key/sig.xml";
Object[] opgenerateKeyArgs=null;
try {
opgenerateKeyArgs = new
Object[] {method,readInput(xmlfile)};
System.out.println(readInput(xmlfile));
} catch (IOException e) {
// TODO Auto-generated
catch block
e.printStackTrace();
}
Class[] returnTypes = new Class[] { String.class };
Object[] response = serviceClient.
invokeBlocking(opgenerateKey,opgenerateKeyArgs,returnTypes);
String r = (String) response[0];
System.out.println("THe return value is :" + r);
}
}
Exception in thread "main" org.apache.axis2.AxisFault:
java.lang.RuntimeException: Unexpected subelement arg0
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper
ation.java:271)
at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisO
peration.java:202)
at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:579
)
at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508
)
at
org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceCl
ient.java:95)
at RPCClass.main(RPCClass.java:53)
--Abhishek
RE: unable to call webservice
Posted by Abhishek Verma <Ab...@symantec.com>.
import java.io.FileReader;
import java.io.IOException;
import javax.xml.namespace.QName;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;
public class RPCClass {
static private String readInput(String filename) throws
java.io.IOException
{
StringBuffer sbuf = new StringBuffer();
FileReader in = new FileReader( filename );
int len;
char cbuf[] = new char[512];
while ((len = in.read( cbuf, 0, cbuf.length)) != -1) {
sbuf.append( cbuf, 0, len );
}
in.close();
return sbuf.toString();
}
public static void main(String[] args1) throws AxisFault {
RPCServiceClient serviceClient = new
RPCServiceClient();
// Options options = serviceClient.getOptions();
EndpointReference targetEPR =
new
EndpointReference("http://127.0.0.1:8080/axis2/services/Keygen");
Options options = new Options();
options.setTo(targetEPR);
serviceClient.setOptions(options);
QName opgenerateKey= new
QName("http://keygen.symantec.com/xsd","generateKey");
String method="SIG";
String xmlfile="E:/WorkSpace/key/sig.xml";
Object[] opgenerateKeyArgs=null;
try {
opgenerateKeyArgs = new
Object[] {method,readInput(xmlfile)};
System.out.println(readInput(xmlfile));
} catch (IOException e) {
// TODO Auto-generated
catch block
e.printStackTrace();
}
// serviceClient.invokeRobust(opgenerateKey,
opgenerateKeyArgs);
Class[] returnTypes = new Class[] { String.class };
Object[] response = serviceClient.
invokeBlocking(opgenerateKey,opgenerateKeyArgs,returnTypes);
String r = (String) response[0];
/*
String method="SIG";
Object[] opgetTestDone = new Object[] {method};
Class[] returnTypes = new Class[] { String.class };
Object[] response = serviceClient.invokeBlocking
(opgenerateKey,opgetTestDone,returnTypes);
//
serviceClient.invokeRobust(opgenerateKey,opgetTestDone);
// serviceClient.invokeNonBlocking(arg0, arg1, arg2)
String r = (String) response[0];*/
System.out.println("THe return value is :" + r);
}
}
Here is my client code and wsdl definition is attached.
--Abhishek
-----Original Message-----
From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
Sent: Tuesday, April 10, 2007 2:03 PM
To: axis-user@ws.apache.org
Subject: RE: unable to call webservice
If you post your code maybe somebody will be able to help you.
Michele
On Tue, 2007-04-10 at 10:41 +0530, Abhishek Verma wrote:
> Hi Michele,
>
> I had made the suggested changes in the code.
>
> Still same problem persist.
>
> Getting the same set of exception.
>
>
>
> Exception in thread "main" org.apache.axis2.AxisFault:
> java.lang.RuntimeException: Unexpected subelement arg0
>
> at
>
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper
ation.java:271)
>
> at
>
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisO
peration.java:202)
>
> at
>
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:579
)
>
> at
>
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508
)
>
> at
>
org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceCl
ient.java:95)
>
> at RPCClass.main(RPCClass.java:55)
>
>
>
>
>
> can any body explain what exactly this exception trace tell.
>
> --Abhishek
>
>
>
>
> ______________________________________________________________________
> From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> Sent: Monday, April 09, 2007 9:26 PM
> To: axis-user@ws.apache.org
> Subject: Re: unable to call webservice
>
>
>
>
> Hi,
>
>
>
>
> I think the way you get the options is not correct. Try:
>
>
>
>
>
> Options options = new Options();
>
>
> options.setTo(...);
>
>
> // eventually more options
>
>
> serviceClient.setOptions(options);
>
>
>
>
>
>
>
>
> Michele
>
>
>
>
>
>
>
>
> On 9 Apr 2007, at 13:19, Abhishek Verma wrote:
>
>
>
>
>
> Subject:
>
>
>
>
> Hi
>
> I have a web service which generate the SSL keys for the given user
>
> I have written the client code to access service but it fails..
>
> Can any body help me..
>
>
>
>
>
> CLIENT CODE
>
> *********************
>
>
>
> import java.io.FileReader;
>
> import java.io.IOException;
>
>
>
> import javax.xml.namespace.QName;
>
>
>
> import org.apache.axis2.AxisFault;
>
> import org.apache.axis2.addressing.EndpointReference;
>
> import org.apache.axis2.client.Options;
>
> import org.apache.axis2.rpc.client.RPCServiceClient;
>
>
>
> public class RPCClass {
>
>
>
> static private String readInput(String filename)
>
> throws java.io.IOException
>
> {
>
> StringBuffer sbuf = new StringBuffer();
>
> FileReader in = new FileReader( filename );
>
> int len;
>
> char cbuf[] = new char[512];
>
> while ((len = in.read( cbuf, 0, cbuf.length)) != -1) {
>
> sbuf.append( cbuf, 0, len );
>
> }
>
> in.close();
>
> return sbuf.toString();
>
> }
>
> public static void main(String[] args1) throws AxisFault {
>
>
>
> RPCServiceClient serviceClient = new
> RPCServiceClient();
>
> Options options = serviceClient.getOptions();
>
> EndpointReference targetEPR =
>
> new EndpointReference("MailScanner warning:
> numerical links are often
> malicious:http://127.0.0.1:8080/axis2/services/Keygen");
>
>
>
> options.setTo(targetEPR);
>
> QName opgenerateKey= new
> QName("http://keygen.symantec.com/xsd","generateKey");
>
>
>
> String method="SIG";
>
> String xmlfile="E:/WorkSpace/key/sig.xml";
>
> Object[] opgenerateKeyArgs=null;
>
>
>
> try {
>
> opgenerateKeyArgs =
> new Object[] {method,readInput(xmlfile)};
>
>
> System.out.println(readInput(xmlfile));
>
> } catch (IOException e) {
>
> // TODO Auto-generated
> catch block
>
> e.printStackTrace();
>
> }
>
>
>
> Class[] returnTypes = new Class[] { String.class };
>
> Object[] response = serviceClient.
>
> invokeBlocking(opgenerateKey,opgenerateKeyArgs,returnTypes);
>
> String r = (String) response[0];
>
> System.out.println("THe return value is :" + r);
>
> }
>
> }
>
>
>
>
>
>
>
>
>
>
>
> java.lang.RuntimeException
>
> OutInAxisOperation.java:271
>
> OutInAxisOperation.java:202
>
> ServiceClient.java:579
>
> ServiceClient.java:508
>
> RPCServiceClient.java:95
>
> RPCClass.java:53
>
>
>
> --Abhishek
>
>
>
>
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
RE: unable to call webservice
Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
If you post your code maybe somebody will be able to help you.
Michele
On Tue, 2007-04-10 at 10:41 +0530, Abhishek Verma wrote:
> Hi Michele,
>
> I had made the suggested changes in the code.
>
> Still same problem persist.
>
> Getting the same set of exception.
>
>
>
> Exception in thread "main" org.apache.axis2.AxisFault:
> java.lang.RuntimeException: Unexpected subelement arg0
>
> at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:271)
>
> at
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
>
> at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:579)
>
> at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508)
>
> at
> org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:95)
>
> at RPCClass.main(RPCClass.java:55)
>
>
>
>
>
> can any body explain what exactly this exception trace tell.
>
> --Abhishek
>
>
>
>
> ______________________________________________________________________
> From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> Sent: Monday, April 09, 2007 9:26 PM
> To: axis-user@ws.apache.org
> Subject: Re: unable to call webservice
>
>
>
>
> Hi,
>
>
>
>
> I think the way you get the options is not correct. Try:
>
>
>
>
>
> Options options = new Options();
>
>
> options.setTo(...);
>
>
> // eventually more options
>
>
> serviceClient.setOptions(options);
>
>
>
>
>
>
>
>
> Michele
>
>
>
>
>
>
>
>
> On 9 Apr 2007, at 13:19, Abhishek Verma wrote:
>
>
>
>
>
> Subject:
>
>
>
>
> Hi
>
> I have a web service which generate the SSL keys for the given user
>
> I have written the client code to access service but it fails..
>
> Can any body help me..
>
>
>
>
>
> CLIENT CODE
>
> *********************
>
>
>
> import java.io.FileReader;
>
> import java.io.IOException;
>
>
>
> import javax.xml.namespace.QName;
>
>
>
> import org.apache.axis2.AxisFault;
>
> import org.apache.axis2.addressing.EndpointReference;
>
> import org.apache.axis2.client.Options;
>
> import org.apache.axis2.rpc.client.RPCServiceClient;
>
>
>
> public class RPCClass {
>
>
>
> static private String readInput(String filename)
>
> throws java.io.IOException
>
> {
>
> StringBuffer sbuf = new StringBuffer();
>
> FileReader in = new FileReader( filename );
>
> int len;
>
> char cbuf[] = new char[512];
>
> while ((len = in.read( cbuf, 0, cbuf.length)) != -1) {
>
> sbuf.append( cbuf, 0, len );
>
> }
>
> in.close();
>
> return sbuf.toString();
>
> }
>
> public static void main(String[] args1) throws AxisFault {
>
>
>
> RPCServiceClient serviceClient = new
> RPCServiceClient();
>
> Options options = serviceClient.getOptions();
>
> EndpointReference targetEPR =
>
> new EndpointReference("MailScanner warning:
> numerical links are often
> malicious:http://127.0.0.1:8080/axis2/services/Keygen");
>
>
>
> options.setTo(targetEPR);
>
> QName opgenerateKey= new
> QName("http://keygen.symantec.com/xsd","generateKey");
>
>
>
> String method="SIG";
>
> String xmlfile="E:/WorkSpace/key/sig.xml";
>
> Object[] opgenerateKeyArgs=null;
>
>
>
> try {
>
> opgenerateKeyArgs =
> new Object[] {method,readInput(xmlfile)};
>
>
> System.out.println(readInput(xmlfile));
>
> } catch (IOException e) {
>
> // TODO Auto-generated
> catch block
>
> e.printStackTrace();
>
> }
>
>
>
> Class[] returnTypes = new Class[] { String.class };
>
> Object[] response = serviceClient.
>
> invokeBlocking(opgenerateKey,opgenerateKeyArgs,returnTypes);
>
> String r = (String) response[0];
>
> System.out.println("THe return value is :" + r);
>
> }
>
> }
>
>
>
>
>
>
>
>
>
>
>
> java.lang.RuntimeException
>
> OutInAxisOperation.java:271
>
> OutInAxisOperation.java:202
>
> ServiceClient.java:579
>
> ServiceClient.java:508
>
> RPCServiceClient.java:95
>
> RPCClass.java:53
>
>
>
> --Abhishek
>
>
>
>
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
RE: unable to call webservice
Posted by Abhishek Verma <Ab...@symantec.com>.
Hi Michele,
I had made the suggested changes in the code.
Still same problem persist.
Getting the same set of exception.
Exception in thread "main" org.apache.axis2.AxisFault:
java.lang.RuntimeException: Unexpected subelement arg0
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper
ation.java:271)
at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisO
peration.java:202)
at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:579
)
at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508
)
at
org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceCl
ient.java:95)
at RPCClass.main(RPCClass.java:55)
can any body explain what exactly this exception trace tell.
--Abhishek
________________________________
From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
Sent: Monday, April 09, 2007 9:26 PM
To: axis-user@ws.apache.org
Subject: Re: unable to call webservice
Hi,
I think the way you get the options is not correct. Try:
Options options = new Options();
options.setTo(...);
// eventually more options
serviceClient.setOptions(options);
Michele
On 9 Apr 2007, at 13:19, Abhishek Verma wrote:
Subject:
Hi
I have a web service which generate the SSL keys for the given user
I have written the client code to access service but it fails..
Can any body help me..
CLIENT CODE
*********************
import java.io.FileReader;
import java.io.IOException;
import javax.xml.namespace.QName;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;
public class RPCClass {
static private String readInput(String filename)
throws java.io.IOException
{
StringBuffer sbuf = new StringBuffer();
FileReader in = new FileReader( filename );
int len;
char cbuf[] = new char[512];
while ((len = in.read( cbuf, 0, cbuf.length)) != -1) {
sbuf.append( cbuf, 0, len );
}
in.close();
return sbuf.toString();
}
public static void main(String[] args1) throws AxisFault {
RPCServiceClient serviceClient = new
RPCServiceClient();
Options options = serviceClient.getOptions();
EndpointReference targetEPR =
new
EndpointReference("http://127.0.0.1:8080/axis2/services/Keygen");
options.setTo(targetEPR);
QName opgenerateKey= new
QName("http://keygen.symantec.com/xsd","generateKey");
String method="SIG";
String xmlfile="E:/WorkSpace/key/sig.xml";
Object[] opgenerateKeyArgs=null;
try {
opgenerateKeyArgs = new
Object[] {method,readInput(xmlfile)};
System.out.println(readInput(xmlfile));
} catch (IOException e) {
// TODO Auto-generated
catch block
e.printStackTrace();
}
Class[] returnTypes = new Class[] { String.class };
Object[] response = serviceClient.
invokeBlocking(opgenerateKey,opgenerateKeyArgs,returnTypes);
String r = (String) response[0];
System.out.println("THe return value is :" + r);
}
}
java.lang.RuntimeException
OutInAxisOperation.java:271
OutInAxisOperation.java:202
ServiceClient.java:579
ServiceClient.java:508
RPCServiceClient.java:95
RPCClass.java:53
--Abhishek
Re: unable to call webservice
Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
Hi,
I think the way you get the options is not correct. Try:
Options options = new Options();
options.setTo(...);
// eventually more options
serviceClient.setOptions(options);
Michele
On 9 Apr 2007, at 13:19, Abhishek Verma wrote:
>
> Subject:
>
>
>
> Hi
>
> I have a web service which generate the SSL keys for the given user
>
> I have written the client code to access service but it fails..
>
> Can any body help me..
>
>
>
>
>
> CLIENT CODE
>
> *********************
>
>
>
> import java.io.FileReader;
>
> import java.io.IOException;
>
>
>
> import javax.xml.namespace.QName;
>
>
>
> import org.apache.axis2.AxisFault;
>
> import org.apache.axis2.addressing.EndpointReference;
>
> import org.apache.axis2.client.Options;
>
> import org.apache.axis2.rpc.client.RPCServiceClient;
>
>
>
> public class RPCClass {
>
>
>
> static private String readInput(String filename)
>
> throws java.io.IOException
>
> {
>
> StringBuffer sbuf = new StringBuffer();
>
> FileReader in = new FileReader( filename );
>
> int len;
>
> char cbuf[] = new char[512];
>
> while ((len = in.read( cbuf, 0, cbuf.length)) != -1) {
>
> sbuf.append( cbuf, 0, len );
>
> }
>
> in.close();
>
> return sbuf.toString();
>
> }
>
> public static void main(String[] args1) throws AxisFault {
>
>
>
> RPCServiceClient serviceClient = new
> RPCServiceClient();
>
> Options options = serviceClient.getOptions();
>
> EndpointReference targetEPR =
>
> new EndpointReference("http://
> 127.0.0.1:8080/axis2/services/Keygen");
>
>
>
> options.setTo(targetEPR);
>
> QName opgenerateKey= new QName("http://
> keygen.symantec.com/xsd","generateKey");
>
>
>
> String method="SIG";
>
> String xmlfile="E:/WorkSpace/key/sig.xml";
>
> Object[] opgenerateKeyArgs=null;
>
>
>
> try {
>
> opgenerateKeyArgs =
> new Object[] {method,readInput(xmlfile)};
>
> System.out.println
> (readInput(xmlfile));
>
> } catch (IOException e) {
>
> // TODO Auto-
> generated catch block
>
> e.printStackTrace();
>
> }
>
>
>
> Class[] returnTypes = new Class[] { String.class };
>
> Object[] response = serviceClient.
>
> invokeBlocking(opgenerateKey,opgenerateKeyArgs,returnTypes);
>
> String r = (String) response[0];
>
> System.out.println("THe return value is :" + r);
>
> }
>
> }
>
>
>
>
>
>
>
>
>
>
>
> Exception in thread "main" org.apache.axis2.AxisFault:
> java.lang.RuntimeException: Unexpected subelement arg0
>
> at org.apache.axis2.description.OutInAxisOperationClient.send
> (OutInAxisOperation.java:271)
>
> at
> org.apache.axis2.description.OutInAxisOperationClient.execute
> (OutInAxisOperation.java:202)
>
> at org.apache.axis2.client.ServiceClient.sendReceive
> (ServiceClient.java:579)
>
> at org.apache.axis2.client.ServiceClient.sendReceive
> (ServiceClient.java:508)
>
> at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking
> (RPCServiceClient.java:95)
>
> at RPCClass.main(RPCClass.java:53)
>
>
>
> --Abhishek
>
>
>
>