As Brian said, if you have a WSDL definition for the service, then you do not need to construct the SOAP message programmatically. Axis wsdl2java can automatically generate java objects from the XML schema definitions of the expected SOAP input and output messages, and at runtime, Axis automatically maps those java objects to the XML schema structures and vice versa. And yes -- it works that way for document-style services.
Thilina's example is using Axis 2 using the low-level AXIOM data model. If you are using Axis 1, then you must use the Axis 1 API instead.
Either way, it's much easier to let Axis map XML to Java for you than to manipulate the XML programmatically.
Anne
On 10/13/05, Carmine Gargiulo <[EMAIL PROTECTED]> wrote:
Thanx!! :)
is for document web service? sure??
other question......also i want write a document-style webservice in axis
that return ,for example, the string "Hello World" to client....but I
REPEAT: document-style webservice.
if your code is for document-style webservice client...then the webservise
is document-style...right?
if yes can you post me the cose ?
is very urgent!! THANX
In data Thu, 13 Oct 2005 06:00:05 +0200, thilina madu
<[EMAIL PROTECTED]> ha scritto:
> 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");
>
> 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);
> BufferedReader br = new BufferedReader(new
> InputStreamReader(System.in));
> try {
> text = br.readLine();
> } catch (IOException e) {
> e.printStackTrace();
> }
> value.setText(text);
> 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);
> //another way to get result
> //OMElement result= call.invokeBlocking("echoFloat",payload);
> OMElement result= call.invokeBlocking("echoFloat",payload);
> StringWriter writer = new StringWriter();
> result.serializeWithCache(XMLOutputFactory.newInstance().
> createXMLStreamWriter(writer));
> 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.
--
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:
Acquista ora Email.it Phone Card e comincia a risparmiare sulle tue telefonate! Clicca e scopri l'offerta
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=2684&d=13-10
