Thank you again Martin,
I tried to send the message below to the list early this morning, but it seems
it never posted (?). What you have written below looks quite helpful.
I decided that the book I had was just TOO OLD (c 2001). Even though I found
the text to be excellent and very easy to follow, I realized that so much has
changed with web services since its publication that I ran a significant risk
(case in point here) of being led toward obsolete technologies and other
dead-ends. I returned the old book and got a copy of "Java Web Services: Up
and Running", (c 2009, O'Reilly). This book, for example, actually addresses
the differences between the RPC and Document styles, a distinction not even
mentioned in the 2001 book. Hopefully this will be a _bit_ more current than
the other one, and I won't run into issues like these with it...
Sorry for the false alarm.
Dan Jonsen
Consultant
Security Software Solutions
On Mar 8, 2010, at 10:57 AM, Martin Gainty wrote:
> Good Morning Dan
>
> Call can be modified to use doc-literal as seen here
> call.setOperationStyle("document");
> call.setOperationUse("literal");
>
> //then when you invoke send a ByteArrayInpueStream of the bytes you wish to
> transmit e.g.
> String firstName=new String("\n<attachments
> xmlns=\"fubar.org/fubar.xsd\">\n<attachment href=\"dan\"/>\n</attachments>";
> Object ret=call.invoke(new Object[]{new SOAPBodyElement(new
> ByteArrayInputStream(firstName.toString().getBytes("UTF-8"))) } );
> //check the ret object coming back for a valid return
>
> does this answer your question?
> many apologies for (weekend delay)
> Martin Gainty
> ______________________________________________
> please do not alter/modify or disrupt this transmission. Thank You
>
>
>
>
> From: [email protected]
> To: [email protected]
> Subject: RE: import header migration from Apache SOAP to Axis2
> Date: Fri, 5 Mar 2010 23:12:54 -0500
>
> currently 2300 Zulu+5 here
> tommorrow is saturday a day i can devote to leisure activities such as Axis
> Development
> i'll take a look tommorow am..
>
> look for a response by sun pm at the latest
> Martin Gainty
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger
> sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung
> oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich
> dem Austausch von Informationen und entfaltet keine rechtliche
> Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
> wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire informez
> l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci
> est interdite. Ce message sert à l'information seulement et n'aura pas
> n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
>
>
>
>
>
> From: [email protected]
> Subject: Re: import header migration from Apache SOAP to Axis2
> Date: Fri, 5 Mar 2010 21:44:21 -0500
> To: [email protected]
>
> Thank you Martin,
>
> I can't imagine that RPC would be a requirement in this case; it's probably
> just what was easier to use in 2001. I am simply trying to get the code
> below to build. If there is a newer/better way to do this using Axis2 with
> minimal changes, that may be easier than downgrading just for RPC capability.
> Any thoughts on how to get the code below to compile would be greatly
> appreciated.
>
> Dan Jonsen
>
> Consultant
> Security Software Solutions
>
> ===================================================================================================
> ===================================================================================================
>
> /*
> * Copyright (c) 2001 Ethan Cerami. All rights reserved.
> * This code is from the book XML Web Services Essentials.
> * It is provided AS-IS, WITHOUT ANY WARRANTY either expressed or implied.
> * You may study, use, and modify it for any non-commercial purpose.
> * You may distribute it non-commercially as long as you retain this notice.
> */
> package com.ecerami.soap;
>
> /**
> * "Hello, SOAP!" SOAP Client
> * usage: java HelloClient first_name
> */
> import java.net.*;
> import java.util.Vector;
> import org.apache.soap.SOAPException;
> import org.apache.soap.Fault;
> import org.apache.soap.Constants;
> import org.apache.soap.rpc.Call;
> import org.apache.soap.rpc.Parameter;
> import org.apache.soap.rpc.Response;
>
> public class HelloClient {
>
> /**
> * Static Main method
> */
> public static void main (String[] args) {
> String firstName = args[0];
> System.out.println ("Hello SOAP Client");
> HelloClient helloClient = new HelloClient();
> try {
> String greeting = helloClient.getGreeting(firstName);
> System.out.print (greeting);
> } catch (SOAPException e) {
> String faultCode = e.getFaultCode();
> String faultMsg = e.getMessage();
> System.err.println ("SOAPException Thrown (details below):");
> System.err.println ("FaultCode: "+faultCode);
> System.err.println ("FaultMessage: "+faultMsg);
> } catch (MalformedURLException e) {
> System.err.println (e);
> }
> }
>
> /**
> * getGreeting Method
> */
> public String getGreeting (String firstName)
> throws SOAPException, MalformedURLException {
>
> // Create SOAP RPC Call Object
> Call call = new Call ();
>
> // Set Encoding Style to standard SOAP encoding
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>
> // Set Object URI and Method Name
> call.setTargetObjectURI ("urn:examples:helloservice");
> call.setMethodName ("sayHello");
>
> // Set Method Parameters
> Parameter param = new Parameter("firstName", String.class,
> firstName, Constants.NS_URI_SOAP_ENC);
>
> Vector paramList = new Vector ();
> paramList.addElement (param);
> call.setParams (paramList);
>
> // Set the URL for the Web Service
> URL url = new URL ("http://localhost:8080/soap/servlet/rpcrouter");
>
> // Invoke the Service
> Response resp = call.invoke (url, "");
>
> // Check for Faults
> if (!resp.generatedFault()) {
> // Extract Return value
> Parameter result = resp.getReturnValue ();
> String greeting = (String) result.getValue();
> return greeting;
> }
> else {
> // Extract Fault Code and String
> Fault f = resp.getFault();
> String faultCode = f.getFaultCode();
> String faultString = f.getFaultString();
> System.err.println("Fault Occurred (details follow):");
> System.err.println("Fault Code: "+faultCode);
> System.err.println("Fault String: "+faultString);
> return new String ("Fault Occurred. No greeting for you!");
> }
> }
> }
>
> ===================================================================================================
> ===================================================================================================
>
>
>
> On Mar 5, 2010, at 9:11 PM, Martin Gainty wrote:
>
> axis2 document-literal style has progressed far beyond single RPC method with
> single parameter roots
> if RPC *is a requirement* you may want to consider fallback to Axis 1.4 for
> RPC capability
>
> any reason why your requirement would prefer RPC over doc-literal type?
> Martin Gainty
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger
> sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung
> oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich
> dem Austausch von Informationen und entfaltet keine rechtliche
> Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
> wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire informez
> l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci
> est interdite. Ce message sert à l'information seulement et n'aura pas
> n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
>
>
>
>
>
> From: [email protected]
> Subject: import header migration from Apache SOAP to Axis2
> Date: Fri, 5 Mar 2010 19:19:03 -0500
> To: [email protected]
>
> I am new to web services in general, and to Java development (though I have
> done a lot of C, C++, and C# development). I am working through the book,
> "Web Services Essentials" by Ethan Cerami, (c) 2002 O'Reilly. I am trying to
> compile one of the examples in the text, but since the book is so old, all of
> the packages it refers to are long since obsolete. I have installed JDK
> 6u18, Tomcat 6.0-24, Axis2 1.5.1, Xerces 2.9.1, Javamail 1.4.3, and Java
> Activation Framework 1.1.1 on my (Vista Ultimate x64) system. When I attempt
> to compile the code, it complains about unresolved external references b/c
> the package names are obsolete. The offending import statements from the
> code are listed below. I have resolved the first 3, but am still unable to
> do so for the last 3.
>
> import org.apache.soap.SOAPException; // OK --> javax.xml.soap.SOAPException
> import org.apache.soap.Fault; // OK --> javax.xml.soap.SOAPFault
> import org.apache.soap.Constants; // OK --> javax.xml.soap.SOAPConstants
> import org.apache.soap.rpc.Call; // still unresolved
> import org.apache.soap.rpc.Parameter; // still unresolved
> import org.apache.soap.rpc.Response; // still unresolved
>
>
> Does anyone know what the last 3 package names should be changed to in order
> to reference equivalent classes in the Axis2 distribution?
>
> Also, does anyone know which JARs in the Axis2 distribution need to be on the
> classpath in order to compile this example? Right now I have classpath set
> to include every JAR in the "lib" directory of the Axis2 distribution (62
> JARs), which I'd really like to cut down on if I can.
>
> Thank you very much for any help you can provide
>
> Dan Jonsen
>
> Consultant, Security Software Solutions
>
>
> Hotmail: Trusted email with Microsoft’s powerful SPAM protection. Sign up now.
>
>
> Hotmail: Free, trusted and rich email service. Get it now.
> Hotmail: Trusted email with Microsoft’s powerful SPAM protection. Sign up now.