users@jax-rpc.java.net

Re: SOAP invocation

From: Anne Thomas Manes <atmanes_at_gmail.com>
Date: Wed, 23 Feb 2005 15:42:32 -0500

Please post the WSDL file. (we can't access it from your localhost(

The message indicates that it doesn't recognize the operation name.

Anne


On Wed, 23 Feb 2005 10:28:46 +0100, Guadalupe Ortiz
<gobellot_at_hotmail.com> wrote:
>
> Related to my previous question. I am trying to build a SOAP message
> (without using JAXRPC) to invoke a JAXRPC service.
> The service is at
> http://localhost:8080/currencyConverterAspects-jaxrpc/currencyConverterAspects?WSDL
>
> And it offers one operation, convert, with three string parametres. The code
> I execute is:
> SOAPConnectionFactory soapConnectionFactory =
> SOAPConnectionFactory.newInstance();
> SOAPConnection connection =
> soapConnectionFactory.createConnection();
> MessageFactory messageFactory =
> MessageFactory.newInstance();
>
> SOAPMessage message =
> messageFactory.createMessage();
>
> SOAPPart part = message.getSOAPPart();
> SOAPEnvelope envelope = part.getEnvelope();
> SOAPBody body = envelope.getBody();
>
> SOAPFactory soapFactory =
> SOAPFactory.newInstance();
> Name bodyName = envelope.createName("convert", "foo",
> "MyCurrencyConverterAspectsService");
> SOAPBodyElement convert = body.addBodyElement(bodyName);
>
>
> Name amountName = envelope.createName("String_1");
> SOAPElement amount = convert.addChildElement(amountName);
> amount.addTextNode("10");
> Name fromCurrencyName = envelope.createName("String_2");
> SOAPElement fromCurrency =
> convert.addChildElement(fromCurrencyName);
> fromCurrency.addTextNode("USD");
> Name toCurrencyName = envelope.createName("String_3");
> SOAPElement toCurrency= convert.addChildElement(toCurrencyName);
> toCurrency.addTextNode("EUR");
>
> message.saveChanges();
>
> System.out.println("\n--- Request Message ---\n");
> message.writeTo(System.out);
>
> URL endpoint = new
> URL("http://localhost:8080/currencyConverterAspects-jaxrpc/currencyConverterAspects");
>
> SOAPMessage reply =
> connection.call(message, endpoint);
>
> System.out.println("\n\nReceived reply from: " +
> endpoint);
> System.out.println("\n---- Reply Message ----\n");
>
> reply.writeTo(System.out);
>
> The fault code I receive in a SOAP faultString is:
> [...]<faultString>JAXRPC.TIE01: caugh exception while handling request:
> unrecognized operation
> {MyCurrencyConverterAspectsService}convert</faultString>
>
> Any clue about what I am doing wrong? Thanks in advance,
> Guadalupe
>