Hi,
here is some code that I am using to acces WS (that code is properly work for my web service) .I think it may helpful to soul your problem.
Even I am a junior to axis please send me any comment about this code segment.
//set endpoint refference
EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO,
"http://127.0.0.1:8080/axis2/services/InteropTest/echoFloat");
EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO,
"http://127.0.0.1:8080/axis2/services/InteropTest/echoFloat");
System.out.println("1. Echoing Floating point");
String text = "";
try {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace
("http://example1.org/example1", "exam");
OMElement value = fac.createOMElement("Text", omNs);
OMElement value = fac.createOMElement("Text", omNs);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
text = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
text = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
value.setText(text);
OMElement payload = value;
OMElement payload = value;
Call call = new Call();
call.setTo(targetEPR);
call.setTransportInfo(Constants.TRANSPORT_HTTP,
Constants.TRANSPORT_HTTP, false);
//Blocking invocation
//// OMElement result = (OMElement) call.invokeBlocking("Getecho", payload);
//// OMElement result = (OMElement) call.invokeBlocking("Getecho", payload);
//another way to get result
//OMElement result= call.invokeBlocking("echoFloat",payload);
OMElement result= call.invokeBlocking("echoFloat",payload);
//OMElement result= call.invokeBlocking("echoFloat",payload);
OMElement result= call.invokeBlocking("echoFloat",payload);
StringWriter writer = new StringWriter();
result.serializeWithCache(XMLOutputFactory.newInstance().
result.serializeWithCache(XMLOutputFactory.newInstance().
createXMLStreamWriter(writer));
writer.flush();
writer.flush();
System.out.println(result.getText());
madushan thilina
Brian Bonner <[EMAIL PROTECTED]> wrote:
If you have the WSDL for a document-style webservice, you can use
WSDL2Java to generate yourself a client that you can work with. Then
you can call the service using the generated client.
Brian
Carmine Gargiulo wrote:
> Hi
>
> i've a BIG problem
>
> for my work i MUST ask infodata to document-style WebService.
>
> In the net i've found a lot of example of clients for RPC-style
> WS...but not for document-style WebService.
>
> In general the code was:
>
> String nameWS = "http://localhost:8080/axis/services/wsRemote";
> URL endPointWS = new URL(nameWS);
>
> // init
> Service service = new Service();
> Call call = (Call) service.createCall();
>
> call.setTargetEndpointAddress(endPointWS);
> call.setOperationName("getFileToString");
>
> String op1 = new String(myParam);
>
> call.addParameter("op1", XMLType.XSD_STRING, ParameterMode.IN);
>
> call.setReturnType(XMLType.XSD_STRING);
>
> ret = String.valueOf(call.invoke(new Object[] {op1}));
>
>
>
> I'm junior of axis and WebService.....and I think that for
> document-style WebService the cose above not is rith.
>
> The WS give me a XML but i don't know ...how take this xml....and if
> this XML is in HD or in memory or other.
>
> Please help me!! I'S VERY URGENT
>
> --Carmine Gargiulo
>
> Carmine Gargiulo usa il rivoluzionario client e-mail di Opera:
> http://www.opera.com/m2/
>
>
> --
> Email.it, the professional e-mail, gratis per te: http://www.email.it/f
>
> Sponsor:
> Digitalpix stampa le tue migliori foto digitali* su vera carta
> fotografica professionale.
> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=1532&d=12-10
Yahoo! Music Unlimited - Access over 1 million songs. Try it free.