45
The Apache SOAP Project Documentation 1. SOAP 1.1. WebServices - SOAP 1.1.1. WebServices - SOAP - Introduction 1.1.1.1. October 15, 2003 - WS-SOAP WebSite Renewed Thanks to Apache Forrest Team, WS-SOAP website has renewed by using this wonderful Forrest Tool. 1.1.1.2. September 15, 2003 - CVS Repository Has Moved CVS Repository has moved to http://cvs.apache.org/viewcvs/ws-soap/ from http://cvs.apache.org/viewcvs/xml-soap/. Repository name is now "ws-soap". For more information, see the WebServices Homepage (CVS) 1.1.1.3. October 27, 2002 - Nightly Builds Have Moved Nightly builds have moved to http://cvs.apache.org/dist/soap/nightly/. Releases are still at http://www.apache.org/dyn/closer.cgi/ws/soap/. 1.1.1.4. June 10, 2002 - Version 2.3.1 Released Click here for a list of changes. 1.1.1.5. May 31, 2002 - Version 2.3 Released Click here for a list of changes. 1.1.1.6. May 30, 2001 - Version 2.2 Released Page 1 Copyright © 1999-2003 The Apache Software Foundation All rights reserved.

The Apache SOAP Project Documentation

  • Upload
    lydiep

  • View
    248

  • Download
    3

Embed Size (px)

Citation preview

Page 1: The Apache SOAP Project Documentation

The Apache SOAP ProjectDocumentation

1 SOAP

11 WebServices - SOAP

111 WebServices - SOAP - Introduction

1111 October 15 2003 - WS-SOAP WebSite Renewed

Thanks to Apache Forrest Team WS-SOAP website has renewed by using this wonderfulForrest Tool

1112 September 15 2003 - CVS Repository Has Moved

CVS Repository has moved to httpcvsapacheorgviewcvsws-soap fromhttpcvsapacheorgviewcvsxml-soap Repository name is now ws-soap For moreinformation see the WebServices Homepage (CVS)

1113 October 27 2002 - Nightly Builds Have Moved

Nightly builds have moved to httpcvsapacheorgdistsoapnightly Releases are still athttpwwwapacheorgdynclosercgiwssoap

1114 June 10 2002 - Version 231 Released

Click here for a list of changes

1115 May 31 2002 - Version 23 Released

Click here for a list of changes

1116 May 30 2001 - Version 22 Released

Page 1Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Click here for a list of changes

1117 February 5 2001 - Version 21 Released

Click here for a list of changes

1118 About Apache SOAP

Apache SOAP (Simple Object Access Protocol) is an implementation of the SOAPsubmission to W3C It is based on and supersedes the IBM SOAP4J implementation

From the draft W3C specification SOAP is a lightweight protocol for exchange ofinformation in a decentralized distributed environment It is an XML based protocol thatconsists of three parts an envelope that defines a framework for describing what is in amessage and how to process it a set of encoding rules for expressing instances ofapplication-defined datatypes and a convention for representing remote procedure calls andresponses

See also the follow-on project Apache Axis

1119 License Information

Apache SOAP is available in both source code and precompiled binary (JAR files) form AllApache SOAP packages are made available under the Apache Software License

12 WebServices - SOAP

121 WebServices - SOAP - General Features

Supports most of the SOAP v11 specification Supports the SOAP Messages withAttachments W3C Note Provides server-side infrastructure for deploying managingand running SOAP enabled services Provides client-side API for invoking SOAPservices Release includes full source under the Apache Software License Supportsthree encoding styles SOAP v11 Encoding Literal XML and XMI XMI encoding(available when using Java 122) supports automatic marshalling and unmarshallingof arbitrary objects SOAP encoding built-in support is provided forencodingdecoding primitive types Strings arbitrary JavaBeans (using reflection)and 1-dimensional arrays of these types For other types user can hand-writeencoderdecoder and register with XML-SOAP runtime Literal XML encoding allowsone to send XML elements (DOM orgw3cdomElement objects) as parameters byembedding the literal XML serialization of the DOM tree No code needs to bewritten to support this (see the addressbook demo to see a sample use of it)Supports messaging and RPC over two transports HTTP and SMTP Supportsauthoring services in scripting languages

The Apache SOAP Project Documentation

Page 2Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

122 WebServices - SOAP - Implementation Restrictions

The following features of the SOAP v11 specification are not currently supportedencodingStyle attribute must have only one encoding style given (see section 411of the spec) mustUnderstand attribute support - only supports checking for andrejecting requests that require mustUnderstand checking root attribute actor attributeand SOAP intermediaries does not use multi-ref accessors during serialization Thefollowing limitations on SOAP Messages with Attachments currently exist Thedocument base URI is not picked up from the multiparts Content-Location headerSupport for relative URIs in Content-Location headers is limited to concatenating thedocument base URI to the relative URI The provided SMTP transport does notsupport multipart messages Server-side RPC methods have no way to addattachments to the response other than via the return object Messaging methodscan do this already

13

14 WebServices - SOAP

141 WebServices - SOAP - Who We Are

The following people are currently committers to the xml-soap project Harmeet BediJonathan Chawke Franciso Curbera Glen Daniels Doug Davis Matthew J DuftlerKevin Mitchell William Nagy Scott Nichol Sam Ruby James Snell SanjivaWeerawarana

15 WebServices - SOAP

151 The Soap Users List

Medium Traffic Subscribe Unsubscribe Archives This is the list where active users ofSoap meet and discuss issues installation problems and what not

152 The Soap Developer List

Medium Traffic Subscribe Unsubscribe Archives This is the list where participatingdevelopers of Soap meet and discuss issues code changesadditions etcSubscribers to this list also get notices of each and every code change build resultstesting notices etc

16 WebServices - SOAP

The Apache SOAP Project Documentation

Page 3Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

161 June 10 2002 - Version 231

Added logic to use xsinil instead of xsinull when using the 2001 Schema specFixed behavior when the 1999 or 2000 schema URI is specified so that theserialization logic uses the older version of both the xsi and the xsd namespaces itwas previously just using the older xsd namespace

162 May 31 2002 - Version 23

Changed default schema to 2001 spec Reflected timeInstant -gt dateTime change in2001 schema spec Added support for primitive XSD data type hexBinary Addedsupport for 2001base64Binary Added HTTPS proxy support Made severalchanges to reduce the overhead of a SOAPMappingRegistry creation and also toreduce the number of SMRs created Removed SMR constructor which took theschema namespace URI because it doesnt work (newing an SMR with the desiredURI isnt enough to make the entire thing use that schema URI) Added agetParent() method to SOAPMappingRegistry to allow the registry tree to bewalked-up Added a test to the SOAPMappingRegistry so that null strings getserialized correctly Fixed a bug that prevents the default encoding from beingcorrectly applied in the SOAPMappingRegistry The SOAPMappingRegistry class asubclass of XMLJavaMappingRegistry now supports chaining ie an instance has aparent with the parent being null for the root instance When looking up amapping the chain is followed if necessary to resolve the mapping TheXMLJavaMappingRegistry class has a method setDefaultEncodingStyle which setsthe default encoding style When this method is called on a SOAPMappingRegistryinstance the default encoding style is set only for the particular link in the chain It isnot set for the parent (and recursively for all parents) This breaks the properapplication of the default Fixed encoding in SOAPHTTPConnection for systemswhose default codepage is not 8859_1 Add deployment descriptor to the bag inSOAPContext so people can query the data in it Fixed the popPollDelay constructorargument in SOAPSMTPConnection so that it is no longer being ignored Put theport number back in the HTTP host header Fixed the behavior ofExceptionFaultListener It was previously not looking in the right place for the type ofthe detail entry to be unmarshalled It was also not printing the encodingStyleattribute Within SOAPException the fault code and exception message will now berun through UtilscleanString() to escape special characters Clean stacktracebacks In particular constructors appear in stack tracebacks as ltinitgt methodsFixed the deployment descriptor so javaType= doesnt get output if the value is nullFixed a bug that prevented a services method from taking a Hashtable array orVector as a parameter while returning a DOM Element Fixed the documentationand code for the Base64 class so that they match and so that encode uses its lenparameter correctly Fixed a bug that prevented the client from using aBeanSerializer to serialize SOAP-encoded parameters within a Call labeled with the

The Apache SOAP Project Documentation

Page 4Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

literalXML encoding style The BooleanDeserializer has been updated to be veryliberal in what it will accept per the spec 0 and 1 are valid boolean values (and infact are the ones used by the WhiteMesa implementation) Synchronized calls toDateFormats methods since DateFormat appears to not be thread-safe Serializedates without losing precision (the JDK format is contains milliseconds) Deserializedates with any number of digits of fractional seconds and with or without a timezone offset Fixed a NullPointerException that was being thrown when a DataSourcewas passed as the source parameter within the MimePartSerializer Started to addthe ability to serialize elements with qualified names If PrefixedName objects arenot explicitly used as the context arguments for serialization the behavior is exactlythe same as it was before Fixed a bug in the EJB providers which printed out thewrong error message Changed context intialization within the EJB providers to allowthe specification of the PROVIDER_URL and INITIAL_CONTEXT_FACTORYseparately Put in the non-debug version of the COM provider Added a method toremove a body part from a Call object Fixed a problem that would cause a Callobjects targetObjectURI property to get set to null if a Fault was returned Pass theactual encoding style on the Call constructor Solves a literal XML interop problemwith pocket soap Fixed a bug that was causing an attribute to be printed without aclosing The DeploymentDescriptor will now allow a TypeMapping to be specifiedwithout the elementType Made the DeploymentDescriptor and TypeMappingsserializingdeserializing logic more tolerant of null values Fixed theDeploymentDescriptortoString() method to correctly display the TypeMappingsRemoved debug println from the DeploymentDescriptor Add support for opts onjava and script services in the ddxml file A type-check was not being performed inthe ServiceManager due to its placement It has been moved so that it now haseffect Added support for setting the configuration file name as a Web applicationcontext parameter so that it will be picked up by the JSPs as well as the routerservlets This will fix the problem of the JSPs using the default ConfigManangerwhen one has been specified for the router servlets Fixed problem of attempting tostore null as the classloader in the servlet attributes Made the servlets store theclassloader from the thread instead of theirs Removed 2 server-side stack tracesfrom the servlets where exceptions were also being propagated Made theServerHTTPUtilsreadEnvelopeFromRequest() method public instead of thedefault package access The code will now only store the target object in theServletContext or HTTPSession when it is newly created and will not store it oneach invocation Added a patch to SOAPHTTPConnection that makes the set-cookieand set-cookie2 header searches case-insensitive Fixed exceptions that are thrownfrom HTTPUtils so that they contain more helpful messages Ensure request URIcontains at least one character Fixed a StringOutOfBoundsException that wasbeing thrown when a server returned a header with no value to an Apache SOAPclient Added a method to DOMUtils to retrieve qualified attribute value That is it willreturna QName representing the value of the requested attribute Fixed a problem

The Apache SOAP Project Documentation

Page 5Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

with QName that Was causing it to throw a NullPointerException if localPartconstructor arg was null Fixed a missing closing ltagt tag in listjsp Build now allowsdist target to build when ejb is not present Added support for config file element toallow users to enable or disable SOAP interface to Service Manager Changed allsamples to use the Fault classs toString() method instead of calling thegetFaultCode() and getFaultString() methods This will cause the samples to displayall the fault information and not just parts of it Added a new calculator demo thatsimulates a reverse polish notation calculator Fixed the EJB sample so that thecorrect parameters are passed to the EJB method Fixed up the interop sample andadded support for the echoMap service Updated to reflect Java 12+ requirementFixed some typos in the documentation Fixed WAS 35 instructions for using thecorrect Xerces JAR Updated deployment descriptor schema to reflect the mappingQName being made optional Made the XMLParserUtilsgetXMLDocBuilder()method synchronized Added support for turning off Nagles algorithm under TCP(HTTP) Fixed ArraySerializer to recognize null items when unmarshalling Changedunmarshalling of xsinull to be just as liberal as BooleanDeserializer is in what itaccepts

163 May 30 2001 - Version 22

Changed all code and samples to use JAXP no longer bound to Xerces Removedmany printlns from the server-side code replacing them with thrown Exceptions Asoapwar Web Application Archive is now included in the distribution for easierdeployment to Servlet containers Included SSL (on Tomcat) doc and linked to itfrom the Installation page Added support for serializingdeserializing javautilMapsAdded support for serializingdeserializing BigDecimal lt--gt xsddecimal Removednon-threadsafe private variables from Servlets If a service method with a matchingsignature is not found a second search is done for a method with an additional (first)parameter of type SOAPContext Users Guide has been re-worked and updatedCOM sample has been updated Added a BEA WebLogic EJB sample Changed theEJB providers so that it grabs the JNDIName from one of the options instead offrom the java class= section of the deployment descriptor For backwardscompatibility if it doesnt find it in the options section (using key=JNDIName) then itwill look in the old java class= section Added an XMLConfigManager Added aBaseConfigManager (to make authoring ConfigManagers easier) Added aworkaround to orgapachesoapFault to enable it to work with Xerces 131 andlater It will now accept a return value of from NodegetNamespaceURI() insteadof just accepting null or a non-empty String Fixed a bug when deserializing nulls oftype ur-type which are generated when the VectorSerializer finds nulls inside aVector Removed requirement of ltjavagt tag in deployment descriptor when usingpluggable providers Fixed a bug where a 400 error code was being returned insteadof the 500 required by SOAP Fixed a bug in header parsing code it was assumingthat a space existed after the character Unmarshalling logic now understands

The Apache SOAP Project Documentation

Page 6Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

1999 2000 and 2001 Schema simple types Unmarshalling logic can nowdeserialize payload with IDHREF attributes RPCRouter can now throw aSOAPException if the checkMustUnderstand property is set on theDeploymentDescriptor and a mustUnderstand=1 attribute is found on a headerThe output buffer size can now be explicitly set on the SOAPHTTPConnectionAdded HTTP proxy basic authentication support The SOAPHTTPConnection nowhas a maintainSession property which when true will cause theSOAPHTTPConnection to return the appropriate cookies with requests It is true bydefault Added a default encoding style property to SOAPMappingRegistry to beused when no encoding style is specified Removed special treatment of CDATAsections in the code that inserts escape sequences The code will now round tripStrings correctly whether they contain CDATA sections or not All the simplenumeric types now use a serializer that does not run its content throughUtilscleanString(String) Cleaned up handling of servlet init-parameters inRPCRouterServlet and MessageRouterServlet Removed transport hook systemproperty dependency The only remaining call to SystemgetProperty(String) is to getlineseparator This should help with some of the security constraints for Appletsand the like Removed some extraneous methods fromorgapachesoaputilStringUtils Put 2 lines back into XMISerializer andXMIDeserializer (the same 1 line in each actually) to enable them to work with thexmisoapjar which is posted on the site These lines were originally there but wereremoved to try to work with the latestXMI version For now the code works with theposted version Added the BidBuy interoperability sample MadeDateSerializerunmarshall() a little more lenient so that it handles parsing dateswith and without milliseconds specified Added a Troubleshooting table and a link toit from the front page Added an Interoperability section to the Users Guide Added aMigration section to the Users Guide Fixed a bug in StatelessEJBProvider andStatefulEJBProvider where the respEncStyle was being set but not used InRPCRouterServletdoGet() and MessageRouterServletdoGet() movedressetContentType() call before resgetWriter() call to be in compliance withServlet spec Added install docs for iPlanet

164 February 5 2001 - Version 21

Added Message Handling Support Added configurable error handling mechanismAdded pluggable provider support Added client-side HTTPS support Added HTTPproxy support Added HTTP basic authentication support Added support for SOAPMessages with Attachments Introduced SOAPContext Added support for transporthooks Added SSL support Reduced dependency on xsitype for deserializationAdded soap configuration file Added pluggable configuration manager Addedsupport for international character sets Added support for defaultserializationdeserialization of Hashtable (as xmlsoapMap) Date (asxsdtimeInstant) GregorianCalendar (as xsddate)

The Apache SOAP Project Documentation

Page 7Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

165 August 18 2000 - Version 20

Deprecated the rpcrouterjsp in favor of an RPCRouter servlet Steven J McDowallNoor Zaman Sanjiva Weerawarana Switched the stockquote demos provider fromwwwi3solutionscom to wwwxmltodaycom Sam Ruby Restructureddocumentation Sanjiva Weerawarana The serializer for javalangString now runs itscontent through UtilscleanString() to escape necessary characters Matthew JDuftler Added a distribution containing the source Matthew J Duftler Created a newsoap webapp Provides access to the web-based admin client and the rpcrouterservlet Sanjiva Weerawarana Changed remaining IBM-SOAP references toApache-SOAP Wouter Cloetens Mike Paolini Matthew J Duftler Added a serializerfor Vectors and Enumerations Glen Daniels Removed trailing in XSD and XSInamespace URIs Steven J McDowall The unmarshalling logic in Fault will nowaccept the SOAP-ENV namespace URI in addition to the old accepted behavior ofno namespace URI at all when processing subelements of Fault Steven JMcDowall Matthew J Duftler HTTPUtilspost() will now use port 80 if no port isspecified Steven J McDowall Fixed a bug that occurred when aServiceManagerClient was instantiated and used to make several invocations Theproblem was when there were no params the params property of the Call objectwas not being set to null Peter Brittenham Matthew J Duftler AddedgetAttributeNS() to DOMUtils It has similar behavior to DOMUtilsgetAttribute()DOMUtilsgetAttributeNS() will return null if there is no specified or default attributevalue Matthew J Duftler Fixed HTTP code to use rn instead of println for lineendings Kevin J Mitchell An array of bytes (ie byte[]) will now be serialized into aSOAP-ENCbase64 type A SOAP-ENCbase64 type will also now be deserializedinto a byte array (ie byte[]) Matthew J Duftler Sanjiva Weerawarana Removedextraneous references to BML namespace URI from deployjsp SanjivaWeerawarana

166 June 4 2000 - Version 12

Created initial code base from IBM-SOAP

2 FAQ

21 Apache SOAP Frequently Asked Questions (FAQ)

211 Apache SOAP Frequently Asked Questions (FAQ)

I have composed this list of questions partly from my own learning process and partly by

The Apache SOAP Project Documentation

Page 8Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

perusing questions from the SOAP User mailing list Corrections and suggestions for newquestions are always welcome Please forward new questions - preferably with answers - orerrors to the SOAP Developer mailing list

See also

bull Messaging The transport part of the XML puzzle by Gordon Van Huizenbull XML Protocol Comparisons produced by the W3Cbull Also see the SOAP FAQ maintained by Developmentorbull A Quick-Start Guide for Installing Apache SOAP by XMethodsbull Jonathan Chawkes SOAP FAQ which will eventually be merged with this FAQ and

hosted on the Apache SOAP web-sitebull SOAP and SMTP FAQ by Jonathan Chawkebull Apache SOAP and WebLogic 61Beta by Steve Livingstonbull Some info on RPC response encoding styles by Matthew J Duftler and Dirck Hecking

Namespaces

bull What are all these SOAP Namespaces

SOAP uses a few different namespaces for different elements and attributes depending onthe role that the data item in question plays in the message formatting handling andorencoding Looking at the Envelope element of a typical SOAP message we see thefollowing namespace declarations

1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchema

where 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) isthe XML Schema Instance namespace and 4) is the XML Schema Definition namespaceSOAP defines the first two namespaces and refers to the second two These namespacesreflect how all data type definitions in SOAP are delegated to XML Schema

The SOAP Envelope namespace defines the Envelope Header and Body elementnames and the encodingStyle actor and mustUnderstand attributes

The SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommendedfor any linear list of objects Ie Java 2 Collection objects can and probably should usethis encoding approach

The XML Schema Instance namespace defines the type attribute which identifies thedata type of an element

The Apache SOAP Project Documentation

Page 9Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

The XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

bull Do I need to use namespaces on my XML data

The short answer is yes but only a little

The long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements thoseelement names will have to be namespace qualified

Although it is technically possible to just use one of the SOAP namespaces it probablyisnt a good idea unless the element name is actually defined in that namespace (iedefined by the SOAP specification)

If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URIwhen you register an element name See Serialization below

bull What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

The Apache SOAP library will generate namespace prefixes as needed to make sure thatall necessary namespaces are declared If the same namespace gets declared twice withtwo different prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local partof the element name (the part after the prefix)

ltSOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacegt ltns3GetData xmlnsns3=urnacmecorpcomnamespacegtltns3GetDatagt

In this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

Serialization

bull How do I send user defined java objects using SOAP

You need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)

Although not required by the SOAP specification the Apache library requires that allXML Elements be namespace qualified via the QName utility class You can use (almost)

The Apache SOAP Project Documentation

Page 10Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

anything for the QName You might think of the first piece as a path and the secondpiece as a SOAP object You might want to use something like the following

SOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENC newQName(urnmyowncomobjects MyObject) ObjectclassmyObjSer myObjSer )

Then when you deploy the service that you are calling you must have a mapping entrythat looks something like the following

ltisdmapencodingStyle=httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializergt

On the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server touse the bean serializer to translate it into a urnmyowncomobjectsMyObject SOAPobject and send it to the client

One the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like touse the serializer called myObjSer to translate the SOAP object into a Java MyObjectobject

The main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use inyour QName object

Note that it is often not necessary to write your own Serializer or Deserializer If yourclass has a get and a set for each attribute that needs to be marshalled you can just usethe Apache SOAP BeanSerializer class

bull What are the different SOAP encoding styles Which should I use

The Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserialzier for anXML element

The SOAP specification allows the encodingStyle attribute to hold multiple URIswhich denote increasingly general encoding rules What isnt defined however is how a

The Apache SOAP Project Documentation

Page 11Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP processor is to determine which encoding style to apply Consequently theApache SOAP library does not support this syntax and will always treat theencodingStyle attribute value as a single URI reference

1 SOAP Encoding

This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully insection 5 of the SOAP specification

2 XMI Encoding3 Literal XML Encoding

bull How do you serialize javautilDate objects

Use BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializeris planned that serializes using the ISO date format

Date objects should be converted to xsddate or xsdtimeInstant to be SOAPcompliant The SOAP spec says For simple types SOAP adopts all the types found inthe section Built-in datatypes of the XML Schema Part 2 Datatypes but not all havebeen implemented

bull How do you return a DOM Element from an RPC Call

The encoding style of a Call return is determined by the encoding style of the RequestDOM Elements use Literal XML encoding For example if a service accepts one StringParameter and returns an Element just set the encoding style for the call tohttpxmlapacheorgxml-soapliteralxml and the encoding style for the parameter tohttpschemasxmlsoaporgsoapencoding Thus part of your client code would looklike Call call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML ) String strparam = joebobVector params = new Vector() paramsaddElement( newParameter( strparam Stringclass strparamConstantsNS_URI_SOAP_ENC ) )

Service Handlers

bull What is an actor

Every SOAP message has primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipient

SOAP allows Header entries to be addressed to specific actors with the

The Apache SOAP Project Documentation

Page 12Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP-ENVactor attribute This attribute contains the URI that uniquely identifies theactor

bull What tools are available that use Apache SOAP

Brought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format thatdescribe SOAP services There is an IBM alphaWorks toolkit that generates Java serviceclient libraries and service handler skeletons from a WSDL document See the WSDLspecification and the IBM toolkit

bull How do I get the samples installed

For Tomcat put the soapjar and samples classes on the system classpath (ie in$TOMCAT_HOMEclasseslib) rather than in webappssoapWEB-INF

bull I am having problems configuring SOAP with Webspere

Apache SOAP has worked under every version of WebSphere from 11 to 302 It willhowever work out of the box on WebSphere 35 with fixpak 2 applied The WebSphereinstall instructions for that level are part of the current SOAP kit You can browse themonline Be sure to check the following items

1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even ifit is default(80) just mention it in the URL ashttpaaabbbcccdddportsoapservletrpcrouter

2 Verify that xerces is at the start of your path not only by setting it in the App but alsoin the websphere configuration files (adminconfig setupclientbat)

bull Does Apache SOAP work with Microsoft SOAP

Yes but you need to install a patch to the MS SOAP package One of the well-knowninteroperability problems between Apache 20 and MS Soap is that MS clients do notsend type information with each parameter and the Apache soap server will reject suchrequests

James Snell has provided a patch adding the typing It can be found at SOAP-WRC website

22 Apache-SOAP Users FAQ

221 Apache-SOAP Users FAQ

This FAQ is based on the questions and answers that appear on the Apache-SOAP UsersMailing ListIt is currently maintained by Jonathan Chawke and was last modified on Sat 15-Mar-20031227 GMT

The Apache SOAP Project Documentation

Page 13Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Corrections and suggestions for new questions are always welcome

Table of Contents Hot Topics This section answers questions that have beenappearing frequently on the mailing list11 Help Im getting this error Element must contain afaultcode element12 Help Im getting this error Unable to resolve namespace URI for xsd13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP service14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not found15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodError16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAP19 How can I view the raw XML data that is exchanged between a SOAP client andserver110 I cant get SOAP working with Tomcat 4 (Catalina) Help

General This section answers general questions21 Where can I get help on SOAP issue XYZ22 Where can I find mailing list archives for the soap-user mailing list23 Im just getting started with SOAP Where can I find a tutorial on SOAP programming24 Are there any other SOAP FAQs available25 Where can I download the SOAP specification document(s)26 Are there any good books on SOAP27 What other SOAP implementations are available28 What is meant by the phrase SOAP is a wire-level protocol29 How does SOAP compare with other XML protocols210 How do I use TcpTunnel and TcpTunnelGUI211 How do I use SOAP over SSL212 How do I use SOAP over SMTP213 What products are available that will let me use ASP or Perl as SOAP client214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could use215 Where do I find nightly builds of the POP3 and SMTP beans218 Is there a way to generate SOAP stubskeleton code from a deployment descriptor219 Is there a way to generate SOAP deployment descriptor from IDL

The Apache SOAP Project Documentation

Page 14Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

220 Is there any way of specifying a timeout for a SOAP method invocation222 Are there any ISPs that will host SOAP applications224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh start228 How do I tell my Apache SOAP client to use a proxy server229 How do I perform Proxy Authentication with my Apache SOAP client230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy server231 Are there any commercially ready servlet containers which will support Apache SOAPclients 232 Where can I find a list of public SOAP services that are available on the Internet234 What tools are available that use Apache SOAP236 How do I restrict access to the Apache SOAP administration client238 How can I get the IP address of a client that is using my SOAP Service240 Can a client programmatically deploy a SOAP service241 Id like to deploy multiple services using a single deployment descriptor file Is thispossible242 Will Apache SOAP support JAXM when its ready243 Will Apache SOAP support JAX-RPC

InstallationThis section helps resolve questions which arise when installing ApacheSOAP in a particular application server environment31 What jar files do I need to provide for Apache-SOAP clients32 How do I install Apache-SOAP on Tomcat 3x33 Can I install Apache-SOAP 21 on Tomcat 4034 How do I install Apache-SOAP on Bea WebLogic 5135 How do I install Apache-SOAP on Bea WebLogic 6036 How do I install Apache-SOAP on Bea WebLogic 61 beta37 How do I install Apache-SOAP on Resin38 How do I install Apache-SOAP on IBM WebSphere39 How do I install Apache-SOAP on Bluestone310 How do I install Apache-SOAP on Orion311 How do I install Apache-SOAP on Apache-JServ312 How do I install Apache-SOAP on iPlanet Web Server313 How do I install Apache-SOAP on iPlanet Application Server314 How do I install Apache-SOAP on Unifys ServletExec316 How do I install Apache-SOAP on Oracle 8i Application Server318 How do I install Apache-SOAP on Borland Application Server (BAS) 45

Troubleshooting This section answers general troubleshooting queries42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijob

The Apache SOAP Project Documentation

Page 15Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 2: The Apache SOAP Project Documentation

Click here for a list of changes

1117 February 5 2001 - Version 21 Released

Click here for a list of changes

1118 About Apache SOAP

Apache SOAP (Simple Object Access Protocol) is an implementation of the SOAPsubmission to W3C It is based on and supersedes the IBM SOAP4J implementation

From the draft W3C specification SOAP is a lightweight protocol for exchange ofinformation in a decentralized distributed environment It is an XML based protocol thatconsists of three parts an envelope that defines a framework for describing what is in amessage and how to process it a set of encoding rules for expressing instances ofapplication-defined datatypes and a convention for representing remote procedure calls andresponses

See also the follow-on project Apache Axis

1119 License Information

Apache SOAP is available in both source code and precompiled binary (JAR files) form AllApache SOAP packages are made available under the Apache Software License

12 WebServices - SOAP

121 WebServices - SOAP - General Features

Supports most of the SOAP v11 specification Supports the SOAP Messages withAttachments W3C Note Provides server-side infrastructure for deploying managingand running SOAP enabled services Provides client-side API for invoking SOAPservices Release includes full source under the Apache Software License Supportsthree encoding styles SOAP v11 Encoding Literal XML and XMI XMI encoding(available when using Java 122) supports automatic marshalling and unmarshallingof arbitrary objects SOAP encoding built-in support is provided forencodingdecoding primitive types Strings arbitrary JavaBeans (using reflection)and 1-dimensional arrays of these types For other types user can hand-writeencoderdecoder and register with XML-SOAP runtime Literal XML encoding allowsone to send XML elements (DOM orgw3cdomElement objects) as parameters byembedding the literal XML serialization of the DOM tree No code needs to bewritten to support this (see the addressbook demo to see a sample use of it)Supports messaging and RPC over two transports HTTP and SMTP Supportsauthoring services in scripting languages

The Apache SOAP Project Documentation

Page 2Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

122 WebServices - SOAP - Implementation Restrictions

The following features of the SOAP v11 specification are not currently supportedencodingStyle attribute must have only one encoding style given (see section 411of the spec) mustUnderstand attribute support - only supports checking for andrejecting requests that require mustUnderstand checking root attribute actor attributeand SOAP intermediaries does not use multi-ref accessors during serialization Thefollowing limitations on SOAP Messages with Attachments currently exist Thedocument base URI is not picked up from the multiparts Content-Location headerSupport for relative URIs in Content-Location headers is limited to concatenating thedocument base URI to the relative URI The provided SMTP transport does notsupport multipart messages Server-side RPC methods have no way to addattachments to the response other than via the return object Messaging methodscan do this already

13

14 WebServices - SOAP

141 WebServices - SOAP - Who We Are

The following people are currently committers to the xml-soap project Harmeet BediJonathan Chawke Franciso Curbera Glen Daniels Doug Davis Matthew J DuftlerKevin Mitchell William Nagy Scott Nichol Sam Ruby James Snell SanjivaWeerawarana

15 WebServices - SOAP

151 The Soap Users List

Medium Traffic Subscribe Unsubscribe Archives This is the list where active users ofSoap meet and discuss issues installation problems and what not

152 The Soap Developer List

Medium Traffic Subscribe Unsubscribe Archives This is the list where participatingdevelopers of Soap meet and discuss issues code changesadditions etcSubscribers to this list also get notices of each and every code change build resultstesting notices etc

16 WebServices - SOAP

The Apache SOAP Project Documentation

Page 3Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

161 June 10 2002 - Version 231

Added logic to use xsinil instead of xsinull when using the 2001 Schema specFixed behavior when the 1999 or 2000 schema URI is specified so that theserialization logic uses the older version of both the xsi and the xsd namespaces itwas previously just using the older xsd namespace

162 May 31 2002 - Version 23

Changed default schema to 2001 spec Reflected timeInstant -gt dateTime change in2001 schema spec Added support for primitive XSD data type hexBinary Addedsupport for 2001base64Binary Added HTTPS proxy support Made severalchanges to reduce the overhead of a SOAPMappingRegistry creation and also toreduce the number of SMRs created Removed SMR constructor which took theschema namespace URI because it doesnt work (newing an SMR with the desiredURI isnt enough to make the entire thing use that schema URI) Added agetParent() method to SOAPMappingRegistry to allow the registry tree to bewalked-up Added a test to the SOAPMappingRegistry so that null strings getserialized correctly Fixed a bug that prevents the default encoding from beingcorrectly applied in the SOAPMappingRegistry The SOAPMappingRegistry class asubclass of XMLJavaMappingRegistry now supports chaining ie an instance has aparent with the parent being null for the root instance When looking up amapping the chain is followed if necessary to resolve the mapping TheXMLJavaMappingRegistry class has a method setDefaultEncodingStyle which setsthe default encoding style When this method is called on a SOAPMappingRegistryinstance the default encoding style is set only for the particular link in the chain It isnot set for the parent (and recursively for all parents) This breaks the properapplication of the default Fixed encoding in SOAPHTTPConnection for systemswhose default codepage is not 8859_1 Add deployment descriptor to the bag inSOAPContext so people can query the data in it Fixed the popPollDelay constructorargument in SOAPSMTPConnection so that it is no longer being ignored Put theport number back in the HTTP host header Fixed the behavior ofExceptionFaultListener It was previously not looking in the right place for the type ofthe detail entry to be unmarshalled It was also not printing the encodingStyleattribute Within SOAPException the fault code and exception message will now berun through UtilscleanString() to escape special characters Clean stacktracebacks In particular constructors appear in stack tracebacks as ltinitgt methodsFixed the deployment descriptor so javaType= doesnt get output if the value is nullFixed a bug that prevented a services method from taking a Hashtable array orVector as a parameter while returning a DOM Element Fixed the documentationand code for the Base64 class so that they match and so that encode uses its lenparameter correctly Fixed a bug that prevented the client from using aBeanSerializer to serialize SOAP-encoded parameters within a Call labeled with the

The Apache SOAP Project Documentation

Page 4Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

literalXML encoding style The BooleanDeserializer has been updated to be veryliberal in what it will accept per the spec 0 and 1 are valid boolean values (and infact are the ones used by the WhiteMesa implementation) Synchronized calls toDateFormats methods since DateFormat appears to not be thread-safe Serializedates without losing precision (the JDK format is contains milliseconds) Deserializedates with any number of digits of fractional seconds and with or without a timezone offset Fixed a NullPointerException that was being thrown when a DataSourcewas passed as the source parameter within the MimePartSerializer Started to addthe ability to serialize elements with qualified names If PrefixedName objects arenot explicitly used as the context arguments for serialization the behavior is exactlythe same as it was before Fixed a bug in the EJB providers which printed out thewrong error message Changed context intialization within the EJB providers to allowthe specification of the PROVIDER_URL and INITIAL_CONTEXT_FACTORYseparately Put in the non-debug version of the COM provider Added a method toremove a body part from a Call object Fixed a problem that would cause a Callobjects targetObjectURI property to get set to null if a Fault was returned Pass theactual encoding style on the Call constructor Solves a literal XML interop problemwith pocket soap Fixed a bug that was causing an attribute to be printed without aclosing The DeploymentDescriptor will now allow a TypeMapping to be specifiedwithout the elementType Made the DeploymentDescriptor and TypeMappingsserializingdeserializing logic more tolerant of null values Fixed theDeploymentDescriptortoString() method to correctly display the TypeMappingsRemoved debug println from the DeploymentDescriptor Add support for opts onjava and script services in the ddxml file A type-check was not being performed inthe ServiceManager due to its placement It has been moved so that it now haseffect Added support for setting the configuration file name as a Web applicationcontext parameter so that it will be picked up by the JSPs as well as the routerservlets This will fix the problem of the JSPs using the default ConfigManangerwhen one has been specified for the router servlets Fixed problem of attempting tostore null as the classloader in the servlet attributes Made the servlets store theclassloader from the thread instead of theirs Removed 2 server-side stack tracesfrom the servlets where exceptions were also being propagated Made theServerHTTPUtilsreadEnvelopeFromRequest() method public instead of thedefault package access The code will now only store the target object in theServletContext or HTTPSession when it is newly created and will not store it oneach invocation Added a patch to SOAPHTTPConnection that makes the set-cookieand set-cookie2 header searches case-insensitive Fixed exceptions that are thrownfrom HTTPUtils so that they contain more helpful messages Ensure request URIcontains at least one character Fixed a StringOutOfBoundsException that wasbeing thrown when a server returned a header with no value to an Apache SOAPclient Added a method to DOMUtils to retrieve qualified attribute value That is it willreturna QName representing the value of the requested attribute Fixed a problem

The Apache SOAP Project Documentation

Page 5Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

with QName that Was causing it to throw a NullPointerException if localPartconstructor arg was null Fixed a missing closing ltagt tag in listjsp Build now allowsdist target to build when ejb is not present Added support for config file element toallow users to enable or disable SOAP interface to Service Manager Changed allsamples to use the Fault classs toString() method instead of calling thegetFaultCode() and getFaultString() methods This will cause the samples to displayall the fault information and not just parts of it Added a new calculator demo thatsimulates a reverse polish notation calculator Fixed the EJB sample so that thecorrect parameters are passed to the EJB method Fixed up the interop sample andadded support for the echoMap service Updated to reflect Java 12+ requirementFixed some typos in the documentation Fixed WAS 35 instructions for using thecorrect Xerces JAR Updated deployment descriptor schema to reflect the mappingQName being made optional Made the XMLParserUtilsgetXMLDocBuilder()method synchronized Added support for turning off Nagles algorithm under TCP(HTTP) Fixed ArraySerializer to recognize null items when unmarshalling Changedunmarshalling of xsinull to be just as liberal as BooleanDeserializer is in what itaccepts

163 May 30 2001 - Version 22

Changed all code and samples to use JAXP no longer bound to Xerces Removedmany printlns from the server-side code replacing them with thrown Exceptions Asoapwar Web Application Archive is now included in the distribution for easierdeployment to Servlet containers Included SSL (on Tomcat) doc and linked to itfrom the Installation page Added support for serializingdeserializing javautilMapsAdded support for serializingdeserializing BigDecimal lt--gt xsddecimal Removednon-threadsafe private variables from Servlets If a service method with a matchingsignature is not found a second search is done for a method with an additional (first)parameter of type SOAPContext Users Guide has been re-worked and updatedCOM sample has been updated Added a BEA WebLogic EJB sample Changed theEJB providers so that it grabs the JNDIName from one of the options instead offrom the java class= section of the deployment descriptor For backwardscompatibility if it doesnt find it in the options section (using key=JNDIName) then itwill look in the old java class= section Added an XMLConfigManager Added aBaseConfigManager (to make authoring ConfigManagers easier) Added aworkaround to orgapachesoapFault to enable it to work with Xerces 131 andlater It will now accept a return value of from NodegetNamespaceURI() insteadof just accepting null or a non-empty String Fixed a bug when deserializing nulls oftype ur-type which are generated when the VectorSerializer finds nulls inside aVector Removed requirement of ltjavagt tag in deployment descriptor when usingpluggable providers Fixed a bug where a 400 error code was being returned insteadof the 500 required by SOAP Fixed a bug in header parsing code it was assumingthat a space existed after the character Unmarshalling logic now understands

The Apache SOAP Project Documentation

Page 6Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

1999 2000 and 2001 Schema simple types Unmarshalling logic can nowdeserialize payload with IDHREF attributes RPCRouter can now throw aSOAPException if the checkMustUnderstand property is set on theDeploymentDescriptor and a mustUnderstand=1 attribute is found on a headerThe output buffer size can now be explicitly set on the SOAPHTTPConnectionAdded HTTP proxy basic authentication support The SOAPHTTPConnection nowhas a maintainSession property which when true will cause theSOAPHTTPConnection to return the appropriate cookies with requests It is true bydefault Added a default encoding style property to SOAPMappingRegistry to beused when no encoding style is specified Removed special treatment of CDATAsections in the code that inserts escape sequences The code will now round tripStrings correctly whether they contain CDATA sections or not All the simplenumeric types now use a serializer that does not run its content throughUtilscleanString(String) Cleaned up handling of servlet init-parameters inRPCRouterServlet and MessageRouterServlet Removed transport hook systemproperty dependency The only remaining call to SystemgetProperty(String) is to getlineseparator This should help with some of the security constraints for Appletsand the like Removed some extraneous methods fromorgapachesoaputilStringUtils Put 2 lines back into XMISerializer andXMIDeserializer (the same 1 line in each actually) to enable them to work with thexmisoapjar which is posted on the site These lines were originally there but wereremoved to try to work with the latestXMI version For now the code works with theposted version Added the BidBuy interoperability sample MadeDateSerializerunmarshall() a little more lenient so that it handles parsing dateswith and without milliseconds specified Added a Troubleshooting table and a link toit from the front page Added an Interoperability section to the Users Guide Added aMigration section to the Users Guide Fixed a bug in StatelessEJBProvider andStatefulEJBProvider where the respEncStyle was being set but not used InRPCRouterServletdoGet() and MessageRouterServletdoGet() movedressetContentType() call before resgetWriter() call to be in compliance withServlet spec Added install docs for iPlanet

164 February 5 2001 - Version 21

Added Message Handling Support Added configurable error handling mechanismAdded pluggable provider support Added client-side HTTPS support Added HTTPproxy support Added HTTP basic authentication support Added support for SOAPMessages with Attachments Introduced SOAPContext Added support for transporthooks Added SSL support Reduced dependency on xsitype for deserializationAdded soap configuration file Added pluggable configuration manager Addedsupport for international character sets Added support for defaultserializationdeserialization of Hashtable (as xmlsoapMap) Date (asxsdtimeInstant) GregorianCalendar (as xsddate)

The Apache SOAP Project Documentation

Page 7Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

165 August 18 2000 - Version 20

Deprecated the rpcrouterjsp in favor of an RPCRouter servlet Steven J McDowallNoor Zaman Sanjiva Weerawarana Switched the stockquote demos provider fromwwwi3solutionscom to wwwxmltodaycom Sam Ruby Restructureddocumentation Sanjiva Weerawarana The serializer for javalangString now runs itscontent through UtilscleanString() to escape necessary characters Matthew JDuftler Added a distribution containing the source Matthew J Duftler Created a newsoap webapp Provides access to the web-based admin client and the rpcrouterservlet Sanjiva Weerawarana Changed remaining IBM-SOAP references toApache-SOAP Wouter Cloetens Mike Paolini Matthew J Duftler Added a serializerfor Vectors and Enumerations Glen Daniels Removed trailing in XSD and XSInamespace URIs Steven J McDowall The unmarshalling logic in Fault will nowaccept the SOAP-ENV namespace URI in addition to the old accepted behavior ofno namespace URI at all when processing subelements of Fault Steven JMcDowall Matthew J Duftler HTTPUtilspost() will now use port 80 if no port isspecified Steven J McDowall Fixed a bug that occurred when aServiceManagerClient was instantiated and used to make several invocations Theproblem was when there were no params the params property of the Call objectwas not being set to null Peter Brittenham Matthew J Duftler AddedgetAttributeNS() to DOMUtils It has similar behavior to DOMUtilsgetAttribute()DOMUtilsgetAttributeNS() will return null if there is no specified or default attributevalue Matthew J Duftler Fixed HTTP code to use rn instead of println for lineendings Kevin J Mitchell An array of bytes (ie byte[]) will now be serialized into aSOAP-ENCbase64 type A SOAP-ENCbase64 type will also now be deserializedinto a byte array (ie byte[]) Matthew J Duftler Sanjiva Weerawarana Removedextraneous references to BML namespace URI from deployjsp SanjivaWeerawarana

166 June 4 2000 - Version 12

Created initial code base from IBM-SOAP

2 FAQ

21 Apache SOAP Frequently Asked Questions (FAQ)

211 Apache SOAP Frequently Asked Questions (FAQ)

I have composed this list of questions partly from my own learning process and partly by

The Apache SOAP Project Documentation

Page 8Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

perusing questions from the SOAP User mailing list Corrections and suggestions for newquestions are always welcome Please forward new questions - preferably with answers - orerrors to the SOAP Developer mailing list

See also

bull Messaging The transport part of the XML puzzle by Gordon Van Huizenbull XML Protocol Comparisons produced by the W3Cbull Also see the SOAP FAQ maintained by Developmentorbull A Quick-Start Guide for Installing Apache SOAP by XMethodsbull Jonathan Chawkes SOAP FAQ which will eventually be merged with this FAQ and

hosted on the Apache SOAP web-sitebull SOAP and SMTP FAQ by Jonathan Chawkebull Apache SOAP and WebLogic 61Beta by Steve Livingstonbull Some info on RPC response encoding styles by Matthew J Duftler and Dirck Hecking

Namespaces

bull What are all these SOAP Namespaces

SOAP uses a few different namespaces for different elements and attributes depending onthe role that the data item in question plays in the message formatting handling andorencoding Looking at the Envelope element of a typical SOAP message we see thefollowing namespace declarations

1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchema

where 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) isthe XML Schema Instance namespace and 4) is the XML Schema Definition namespaceSOAP defines the first two namespaces and refers to the second two These namespacesreflect how all data type definitions in SOAP are delegated to XML Schema

The SOAP Envelope namespace defines the Envelope Header and Body elementnames and the encodingStyle actor and mustUnderstand attributes

The SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommendedfor any linear list of objects Ie Java 2 Collection objects can and probably should usethis encoding approach

The XML Schema Instance namespace defines the type attribute which identifies thedata type of an element

The Apache SOAP Project Documentation

Page 9Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

The XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

bull Do I need to use namespaces on my XML data

The short answer is yes but only a little

The long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements thoseelement names will have to be namespace qualified

Although it is technically possible to just use one of the SOAP namespaces it probablyisnt a good idea unless the element name is actually defined in that namespace (iedefined by the SOAP specification)

If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URIwhen you register an element name See Serialization below

bull What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

The Apache SOAP library will generate namespace prefixes as needed to make sure thatall necessary namespaces are declared If the same namespace gets declared twice withtwo different prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local partof the element name (the part after the prefix)

ltSOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacegt ltns3GetData xmlnsns3=urnacmecorpcomnamespacegtltns3GetDatagt

In this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

Serialization

bull How do I send user defined java objects using SOAP

You need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)

Although not required by the SOAP specification the Apache library requires that allXML Elements be namespace qualified via the QName utility class You can use (almost)

The Apache SOAP Project Documentation

Page 10Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

anything for the QName You might think of the first piece as a path and the secondpiece as a SOAP object You might want to use something like the following

SOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENC newQName(urnmyowncomobjects MyObject) ObjectclassmyObjSer myObjSer )

Then when you deploy the service that you are calling you must have a mapping entrythat looks something like the following

ltisdmapencodingStyle=httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializergt

On the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server touse the bean serializer to translate it into a urnmyowncomobjectsMyObject SOAPobject and send it to the client

One the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like touse the serializer called myObjSer to translate the SOAP object into a Java MyObjectobject

The main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use inyour QName object

Note that it is often not necessary to write your own Serializer or Deserializer If yourclass has a get and a set for each attribute that needs to be marshalled you can just usethe Apache SOAP BeanSerializer class

bull What are the different SOAP encoding styles Which should I use

The Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserialzier for anXML element

The SOAP specification allows the encodingStyle attribute to hold multiple URIswhich denote increasingly general encoding rules What isnt defined however is how a

The Apache SOAP Project Documentation

Page 11Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP processor is to determine which encoding style to apply Consequently theApache SOAP library does not support this syntax and will always treat theencodingStyle attribute value as a single URI reference

1 SOAP Encoding

This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully insection 5 of the SOAP specification

2 XMI Encoding3 Literal XML Encoding

bull How do you serialize javautilDate objects

Use BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializeris planned that serializes using the ISO date format

Date objects should be converted to xsddate or xsdtimeInstant to be SOAPcompliant The SOAP spec says For simple types SOAP adopts all the types found inthe section Built-in datatypes of the XML Schema Part 2 Datatypes but not all havebeen implemented

bull How do you return a DOM Element from an RPC Call

The encoding style of a Call return is determined by the encoding style of the RequestDOM Elements use Literal XML encoding For example if a service accepts one StringParameter and returns an Element just set the encoding style for the call tohttpxmlapacheorgxml-soapliteralxml and the encoding style for the parameter tohttpschemasxmlsoaporgsoapencoding Thus part of your client code would looklike Call call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML ) String strparam = joebobVector params = new Vector() paramsaddElement( newParameter( strparam Stringclass strparamConstantsNS_URI_SOAP_ENC ) )

Service Handlers

bull What is an actor

Every SOAP message has primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipient

SOAP allows Header entries to be addressed to specific actors with the

The Apache SOAP Project Documentation

Page 12Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP-ENVactor attribute This attribute contains the URI that uniquely identifies theactor

bull What tools are available that use Apache SOAP

Brought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format thatdescribe SOAP services There is an IBM alphaWorks toolkit that generates Java serviceclient libraries and service handler skeletons from a WSDL document See the WSDLspecification and the IBM toolkit

bull How do I get the samples installed

For Tomcat put the soapjar and samples classes on the system classpath (ie in$TOMCAT_HOMEclasseslib) rather than in webappssoapWEB-INF

bull I am having problems configuring SOAP with Webspere

Apache SOAP has worked under every version of WebSphere from 11 to 302 It willhowever work out of the box on WebSphere 35 with fixpak 2 applied The WebSphereinstall instructions for that level are part of the current SOAP kit You can browse themonline Be sure to check the following items

1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even ifit is default(80) just mention it in the URL ashttpaaabbbcccdddportsoapservletrpcrouter

2 Verify that xerces is at the start of your path not only by setting it in the App but alsoin the websphere configuration files (adminconfig setupclientbat)

bull Does Apache SOAP work with Microsoft SOAP

Yes but you need to install a patch to the MS SOAP package One of the well-knowninteroperability problems between Apache 20 and MS Soap is that MS clients do notsend type information with each parameter and the Apache soap server will reject suchrequests

James Snell has provided a patch adding the typing It can be found at SOAP-WRC website

22 Apache-SOAP Users FAQ

221 Apache-SOAP Users FAQ

This FAQ is based on the questions and answers that appear on the Apache-SOAP UsersMailing ListIt is currently maintained by Jonathan Chawke and was last modified on Sat 15-Mar-20031227 GMT

The Apache SOAP Project Documentation

Page 13Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Corrections and suggestions for new questions are always welcome

Table of Contents Hot Topics This section answers questions that have beenappearing frequently on the mailing list11 Help Im getting this error Element must contain afaultcode element12 Help Im getting this error Unable to resolve namespace URI for xsd13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP service14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not found15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodError16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAP19 How can I view the raw XML data that is exchanged between a SOAP client andserver110 I cant get SOAP working with Tomcat 4 (Catalina) Help

General This section answers general questions21 Where can I get help on SOAP issue XYZ22 Where can I find mailing list archives for the soap-user mailing list23 Im just getting started with SOAP Where can I find a tutorial on SOAP programming24 Are there any other SOAP FAQs available25 Where can I download the SOAP specification document(s)26 Are there any good books on SOAP27 What other SOAP implementations are available28 What is meant by the phrase SOAP is a wire-level protocol29 How does SOAP compare with other XML protocols210 How do I use TcpTunnel and TcpTunnelGUI211 How do I use SOAP over SSL212 How do I use SOAP over SMTP213 What products are available that will let me use ASP or Perl as SOAP client214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could use215 Where do I find nightly builds of the POP3 and SMTP beans218 Is there a way to generate SOAP stubskeleton code from a deployment descriptor219 Is there a way to generate SOAP deployment descriptor from IDL

The Apache SOAP Project Documentation

Page 14Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

220 Is there any way of specifying a timeout for a SOAP method invocation222 Are there any ISPs that will host SOAP applications224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh start228 How do I tell my Apache SOAP client to use a proxy server229 How do I perform Proxy Authentication with my Apache SOAP client230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy server231 Are there any commercially ready servlet containers which will support Apache SOAPclients 232 Where can I find a list of public SOAP services that are available on the Internet234 What tools are available that use Apache SOAP236 How do I restrict access to the Apache SOAP administration client238 How can I get the IP address of a client that is using my SOAP Service240 Can a client programmatically deploy a SOAP service241 Id like to deploy multiple services using a single deployment descriptor file Is thispossible242 Will Apache SOAP support JAXM when its ready243 Will Apache SOAP support JAX-RPC

InstallationThis section helps resolve questions which arise when installing ApacheSOAP in a particular application server environment31 What jar files do I need to provide for Apache-SOAP clients32 How do I install Apache-SOAP on Tomcat 3x33 Can I install Apache-SOAP 21 on Tomcat 4034 How do I install Apache-SOAP on Bea WebLogic 5135 How do I install Apache-SOAP on Bea WebLogic 6036 How do I install Apache-SOAP on Bea WebLogic 61 beta37 How do I install Apache-SOAP on Resin38 How do I install Apache-SOAP on IBM WebSphere39 How do I install Apache-SOAP on Bluestone310 How do I install Apache-SOAP on Orion311 How do I install Apache-SOAP on Apache-JServ312 How do I install Apache-SOAP on iPlanet Web Server313 How do I install Apache-SOAP on iPlanet Application Server314 How do I install Apache-SOAP on Unifys ServletExec316 How do I install Apache-SOAP on Oracle 8i Application Server318 How do I install Apache-SOAP on Borland Application Server (BAS) 45

Troubleshooting This section answers general troubleshooting queries42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijob

The Apache SOAP Project Documentation

Page 15Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 3: The Apache SOAP Project Documentation

122 WebServices - SOAP - Implementation Restrictions

The following features of the SOAP v11 specification are not currently supportedencodingStyle attribute must have only one encoding style given (see section 411of the spec) mustUnderstand attribute support - only supports checking for andrejecting requests that require mustUnderstand checking root attribute actor attributeand SOAP intermediaries does not use multi-ref accessors during serialization Thefollowing limitations on SOAP Messages with Attachments currently exist Thedocument base URI is not picked up from the multiparts Content-Location headerSupport for relative URIs in Content-Location headers is limited to concatenating thedocument base URI to the relative URI The provided SMTP transport does notsupport multipart messages Server-side RPC methods have no way to addattachments to the response other than via the return object Messaging methodscan do this already

13

14 WebServices - SOAP

141 WebServices - SOAP - Who We Are

The following people are currently committers to the xml-soap project Harmeet BediJonathan Chawke Franciso Curbera Glen Daniels Doug Davis Matthew J DuftlerKevin Mitchell William Nagy Scott Nichol Sam Ruby James Snell SanjivaWeerawarana

15 WebServices - SOAP

151 The Soap Users List

Medium Traffic Subscribe Unsubscribe Archives This is the list where active users ofSoap meet and discuss issues installation problems and what not

152 The Soap Developer List

Medium Traffic Subscribe Unsubscribe Archives This is the list where participatingdevelopers of Soap meet and discuss issues code changesadditions etcSubscribers to this list also get notices of each and every code change build resultstesting notices etc

16 WebServices - SOAP

The Apache SOAP Project Documentation

Page 3Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

161 June 10 2002 - Version 231

Added logic to use xsinil instead of xsinull when using the 2001 Schema specFixed behavior when the 1999 or 2000 schema URI is specified so that theserialization logic uses the older version of both the xsi and the xsd namespaces itwas previously just using the older xsd namespace

162 May 31 2002 - Version 23

Changed default schema to 2001 spec Reflected timeInstant -gt dateTime change in2001 schema spec Added support for primitive XSD data type hexBinary Addedsupport for 2001base64Binary Added HTTPS proxy support Made severalchanges to reduce the overhead of a SOAPMappingRegistry creation and also toreduce the number of SMRs created Removed SMR constructor which took theschema namespace URI because it doesnt work (newing an SMR with the desiredURI isnt enough to make the entire thing use that schema URI) Added agetParent() method to SOAPMappingRegistry to allow the registry tree to bewalked-up Added a test to the SOAPMappingRegistry so that null strings getserialized correctly Fixed a bug that prevents the default encoding from beingcorrectly applied in the SOAPMappingRegistry The SOAPMappingRegistry class asubclass of XMLJavaMappingRegistry now supports chaining ie an instance has aparent with the parent being null for the root instance When looking up amapping the chain is followed if necessary to resolve the mapping TheXMLJavaMappingRegistry class has a method setDefaultEncodingStyle which setsthe default encoding style When this method is called on a SOAPMappingRegistryinstance the default encoding style is set only for the particular link in the chain It isnot set for the parent (and recursively for all parents) This breaks the properapplication of the default Fixed encoding in SOAPHTTPConnection for systemswhose default codepage is not 8859_1 Add deployment descriptor to the bag inSOAPContext so people can query the data in it Fixed the popPollDelay constructorargument in SOAPSMTPConnection so that it is no longer being ignored Put theport number back in the HTTP host header Fixed the behavior ofExceptionFaultListener It was previously not looking in the right place for the type ofthe detail entry to be unmarshalled It was also not printing the encodingStyleattribute Within SOAPException the fault code and exception message will now berun through UtilscleanString() to escape special characters Clean stacktracebacks In particular constructors appear in stack tracebacks as ltinitgt methodsFixed the deployment descriptor so javaType= doesnt get output if the value is nullFixed a bug that prevented a services method from taking a Hashtable array orVector as a parameter while returning a DOM Element Fixed the documentationand code for the Base64 class so that they match and so that encode uses its lenparameter correctly Fixed a bug that prevented the client from using aBeanSerializer to serialize SOAP-encoded parameters within a Call labeled with the

The Apache SOAP Project Documentation

Page 4Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

literalXML encoding style The BooleanDeserializer has been updated to be veryliberal in what it will accept per the spec 0 and 1 are valid boolean values (and infact are the ones used by the WhiteMesa implementation) Synchronized calls toDateFormats methods since DateFormat appears to not be thread-safe Serializedates without losing precision (the JDK format is contains milliseconds) Deserializedates with any number of digits of fractional seconds and with or without a timezone offset Fixed a NullPointerException that was being thrown when a DataSourcewas passed as the source parameter within the MimePartSerializer Started to addthe ability to serialize elements with qualified names If PrefixedName objects arenot explicitly used as the context arguments for serialization the behavior is exactlythe same as it was before Fixed a bug in the EJB providers which printed out thewrong error message Changed context intialization within the EJB providers to allowthe specification of the PROVIDER_URL and INITIAL_CONTEXT_FACTORYseparately Put in the non-debug version of the COM provider Added a method toremove a body part from a Call object Fixed a problem that would cause a Callobjects targetObjectURI property to get set to null if a Fault was returned Pass theactual encoding style on the Call constructor Solves a literal XML interop problemwith pocket soap Fixed a bug that was causing an attribute to be printed without aclosing The DeploymentDescriptor will now allow a TypeMapping to be specifiedwithout the elementType Made the DeploymentDescriptor and TypeMappingsserializingdeserializing logic more tolerant of null values Fixed theDeploymentDescriptortoString() method to correctly display the TypeMappingsRemoved debug println from the DeploymentDescriptor Add support for opts onjava and script services in the ddxml file A type-check was not being performed inthe ServiceManager due to its placement It has been moved so that it now haseffect Added support for setting the configuration file name as a Web applicationcontext parameter so that it will be picked up by the JSPs as well as the routerservlets This will fix the problem of the JSPs using the default ConfigManangerwhen one has been specified for the router servlets Fixed problem of attempting tostore null as the classloader in the servlet attributes Made the servlets store theclassloader from the thread instead of theirs Removed 2 server-side stack tracesfrom the servlets where exceptions were also being propagated Made theServerHTTPUtilsreadEnvelopeFromRequest() method public instead of thedefault package access The code will now only store the target object in theServletContext or HTTPSession when it is newly created and will not store it oneach invocation Added a patch to SOAPHTTPConnection that makes the set-cookieand set-cookie2 header searches case-insensitive Fixed exceptions that are thrownfrom HTTPUtils so that they contain more helpful messages Ensure request URIcontains at least one character Fixed a StringOutOfBoundsException that wasbeing thrown when a server returned a header with no value to an Apache SOAPclient Added a method to DOMUtils to retrieve qualified attribute value That is it willreturna QName representing the value of the requested attribute Fixed a problem

The Apache SOAP Project Documentation

Page 5Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

with QName that Was causing it to throw a NullPointerException if localPartconstructor arg was null Fixed a missing closing ltagt tag in listjsp Build now allowsdist target to build when ejb is not present Added support for config file element toallow users to enable or disable SOAP interface to Service Manager Changed allsamples to use the Fault classs toString() method instead of calling thegetFaultCode() and getFaultString() methods This will cause the samples to displayall the fault information and not just parts of it Added a new calculator demo thatsimulates a reverse polish notation calculator Fixed the EJB sample so that thecorrect parameters are passed to the EJB method Fixed up the interop sample andadded support for the echoMap service Updated to reflect Java 12+ requirementFixed some typos in the documentation Fixed WAS 35 instructions for using thecorrect Xerces JAR Updated deployment descriptor schema to reflect the mappingQName being made optional Made the XMLParserUtilsgetXMLDocBuilder()method synchronized Added support for turning off Nagles algorithm under TCP(HTTP) Fixed ArraySerializer to recognize null items when unmarshalling Changedunmarshalling of xsinull to be just as liberal as BooleanDeserializer is in what itaccepts

163 May 30 2001 - Version 22

Changed all code and samples to use JAXP no longer bound to Xerces Removedmany printlns from the server-side code replacing them with thrown Exceptions Asoapwar Web Application Archive is now included in the distribution for easierdeployment to Servlet containers Included SSL (on Tomcat) doc and linked to itfrom the Installation page Added support for serializingdeserializing javautilMapsAdded support for serializingdeserializing BigDecimal lt--gt xsddecimal Removednon-threadsafe private variables from Servlets If a service method with a matchingsignature is not found a second search is done for a method with an additional (first)parameter of type SOAPContext Users Guide has been re-worked and updatedCOM sample has been updated Added a BEA WebLogic EJB sample Changed theEJB providers so that it grabs the JNDIName from one of the options instead offrom the java class= section of the deployment descriptor For backwardscompatibility if it doesnt find it in the options section (using key=JNDIName) then itwill look in the old java class= section Added an XMLConfigManager Added aBaseConfigManager (to make authoring ConfigManagers easier) Added aworkaround to orgapachesoapFault to enable it to work with Xerces 131 andlater It will now accept a return value of from NodegetNamespaceURI() insteadof just accepting null or a non-empty String Fixed a bug when deserializing nulls oftype ur-type which are generated when the VectorSerializer finds nulls inside aVector Removed requirement of ltjavagt tag in deployment descriptor when usingpluggable providers Fixed a bug where a 400 error code was being returned insteadof the 500 required by SOAP Fixed a bug in header parsing code it was assumingthat a space existed after the character Unmarshalling logic now understands

The Apache SOAP Project Documentation

Page 6Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

1999 2000 and 2001 Schema simple types Unmarshalling logic can nowdeserialize payload with IDHREF attributes RPCRouter can now throw aSOAPException if the checkMustUnderstand property is set on theDeploymentDescriptor and a mustUnderstand=1 attribute is found on a headerThe output buffer size can now be explicitly set on the SOAPHTTPConnectionAdded HTTP proxy basic authentication support The SOAPHTTPConnection nowhas a maintainSession property which when true will cause theSOAPHTTPConnection to return the appropriate cookies with requests It is true bydefault Added a default encoding style property to SOAPMappingRegistry to beused when no encoding style is specified Removed special treatment of CDATAsections in the code that inserts escape sequences The code will now round tripStrings correctly whether they contain CDATA sections or not All the simplenumeric types now use a serializer that does not run its content throughUtilscleanString(String) Cleaned up handling of servlet init-parameters inRPCRouterServlet and MessageRouterServlet Removed transport hook systemproperty dependency The only remaining call to SystemgetProperty(String) is to getlineseparator This should help with some of the security constraints for Appletsand the like Removed some extraneous methods fromorgapachesoaputilStringUtils Put 2 lines back into XMISerializer andXMIDeserializer (the same 1 line in each actually) to enable them to work with thexmisoapjar which is posted on the site These lines were originally there but wereremoved to try to work with the latestXMI version For now the code works with theposted version Added the BidBuy interoperability sample MadeDateSerializerunmarshall() a little more lenient so that it handles parsing dateswith and without milliseconds specified Added a Troubleshooting table and a link toit from the front page Added an Interoperability section to the Users Guide Added aMigration section to the Users Guide Fixed a bug in StatelessEJBProvider andStatefulEJBProvider where the respEncStyle was being set but not used InRPCRouterServletdoGet() and MessageRouterServletdoGet() movedressetContentType() call before resgetWriter() call to be in compliance withServlet spec Added install docs for iPlanet

164 February 5 2001 - Version 21

Added Message Handling Support Added configurable error handling mechanismAdded pluggable provider support Added client-side HTTPS support Added HTTPproxy support Added HTTP basic authentication support Added support for SOAPMessages with Attachments Introduced SOAPContext Added support for transporthooks Added SSL support Reduced dependency on xsitype for deserializationAdded soap configuration file Added pluggable configuration manager Addedsupport for international character sets Added support for defaultserializationdeserialization of Hashtable (as xmlsoapMap) Date (asxsdtimeInstant) GregorianCalendar (as xsddate)

The Apache SOAP Project Documentation

Page 7Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

165 August 18 2000 - Version 20

Deprecated the rpcrouterjsp in favor of an RPCRouter servlet Steven J McDowallNoor Zaman Sanjiva Weerawarana Switched the stockquote demos provider fromwwwi3solutionscom to wwwxmltodaycom Sam Ruby Restructureddocumentation Sanjiva Weerawarana The serializer for javalangString now runs itscontent through UtilscleanString() to escape necessary characters Matthew JDuftler Added a distribution containing the source Matthew J Duftler Created a newsoap webapp Provides access to the web-based admin client and the rpcrouterservlet Sanjiva Weerawarana Changed remaining IBM-SOAP references toApache-SOAP Wouter Cloetens Mike Paolini Matthew J Duftler Added a serializerfor Vectors and Enumerations Glen Daniels Removed trailing in XSD and XSInamespace URIs Steven J McDowall The unmarshalling logic in Fault will nowaccept the SOAP-ENV namespace URI in addition to the old accepted behavior ofno namespace URI at all when processing subelements of Fault Steven JMcDowall Matthew J Duftler HTTPUtilspost() will now use port 80 if no port isspecified Steven J McDowall Fixed a bug that occurred when aServiceManagerClient was instantiated and used to make several invocations Theproblem was when there were no params the params property of the Call objectwas not being set to null Peter Brittenham Matthew J Duftler AddedgetAttributeNS() to DOMUtils It has similar behavior to DOMUtilsgetAttribute()DOMUtilsgetAttributeNS() will return null if there is no specified or default attributevalue Matthew J Duftler Fixed HTTP code to use rn instead of println for lineendings Kevin J Mitchell An array of bytes (ie byte[]) will now be serialized into aSOAP-ENCbase64 type A SOAP-ENCbase64 type will also now be deserializedinto a byte array (ie byte[]) Matthew J Duftler Sanjiva Weerawarana Removedextraneous references to BML namespace URI from deployjsp SanjivaWeerawarana

166 June 4 2000 - Version 12

Created initial code base from IBM-SOAP

2 FAQ

21 Apache SOAP Frequently Asked Questions (FAQ)

211 Apache SOAP Frequently Asked Questions (FAQ)

I have composed this list of questions partly from my own learning process and partly by

The Apache SOAP Project Documentation

Page 8Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

perusing questions from the SOAP User mailing list Corrections and suggestions for newquestions are always welcome Please forward new questions - preferably with answers - orerrors to the SOAP Developer mailing list

See also

bull Messaging The transport part of the XML puzzle by Gordon Van Huizenbull XML Protocol Comparisons produced by the W3Cbull Also see the SOAP FAQ maintained by Developmentorbull A Quick-Start Guide for Installing Apache SOAP by XMethodsbull Jonathan Chawkes SOAP FAQ which will eventually be merged with this FAQ and

hosted on the Apache SOAP web-sitebull SOAP and SMTP FAQ by Jonathan Chawkebull Apache SOAP and WebLogic 61Beta by Steve Livingstonbull Some info on RPC response encoding styles by Matthew J Duftler and Dirck Hecking

Namespaces

bull What are all these SOAP Namespaces

SOAP uses a few different namespaces for different elements and attributes depending onthe role that the data item in question plays in the message formatting handling andorencoding Looking at the Envelope element of a typical SOAP message we see thefollowing namespace declarations

1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchema

where 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) isthe XML Schema Instance namespace and 4) is the XML Schema Definition namespaceSOAP defines the first two namespaces and refers to the second two These namespacesreflect how all data type definitions in SOAP are delegated to XML Schema

The SOAP Envelope namespace defines the Envelope Header and Body elementnames and the encodingStyle actor and mustUnderstand attributes

The SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommendedfor any linear list of objects Ie Java 2 Collection objects can and probably should usethis encoding approach

The XML Schema Instance namespace defines the type attribute which identifies thedata type of an element

The Apache SOAP Project Documentation

Page 9Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

The XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

bull Do I need to use namespaces on my XML data

The short answer is yes but only a little

The long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements thoseelement names will have to be namespace qualified

Although it is technically possible to just use one of the SOAP namespaces it probablyisnt a good idea unless the element name is actually defined in that namespace (iedefined by the SOAP specification)

If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URIwhen you register an element name See Serialization below

bull What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

The Apache SOAP library will generate namespace prefixes as needed to make sure thatall necessary namespaces are declared If the same namespace gets declared twice withtwo different prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local partof the element name (the part after the prefix)

ltSOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacegt ltns3GetData xmlnsns3=urnacmecorpcomnamespacegtltns3GetDatagt

In this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

Serialization

bull How do I send user defined java objects using SOAP

You need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)

Although not required by the SOAP specification the Apache library requires that allXML Elements be namespace qualified via the QName utility class You can use (almost)

The Apache SOAP Project Documentation

Page 10Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

anything for the QName You might think of the first piece as a path and the secondpiece as a SOAP object You might want to use something like the following

SOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENC newQName(urnmyowncomobjects MyObject) ObjectclassmyObjSer myObjSer )

Then when you deploy the service that you are calling you must have a mapping entrythat looks something like the following

ltisdmapencodingStyle=httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializergt

On the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server touse the bean serializer to translate it into a urnmyowncomobjectsMyObject SOAPobject and send it to the client

One the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like touse the serializer called myObjSer to translate the SOAP object into a Java MyObjectobject

The main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use inyour QName object

Note that it is often not necessary to write your own Serializer or Deserializer If yourclass has a get and a set for each attribute that needs to be marshalled you can just usethe Apache SOAP BeanSerializer class

bull What are the different SOAP encoding styles Which should I use

The Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserialzier for anXML element

The SOAP specification allows the encodingStyle attribute to hold multiple URIswhich denote increasingly general encoding rules What isnt defined however is how a

The Apache SOAP Project Documentation

Page 11Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP processor is to determine which encoding style to apply Consequently theApache SOAP library does not support this syntax and will always treat theencodingStyle attribute value as a single URI reference

1 SOAP Encoding

This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully insection 5 of the SOAP specification

2 XMI Encoding3 Literal XML Encoding

bull How do you serialize javautilDate objects

Use BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializeris planned that serializes using the ISO date format

Date objects should be converted to xsddate or xsdtimeInstant to be SOAPcompliant The SOAP spec says For simple types SOAP adopts all the types found inthe section Built-in datatypes of the XML Schema Part 2 Datatypes but not all havebeen implemented

bull How do you return a DOM Element from an RPC Call

The encoding style of a Call return is determined by the encoding style of the RequestDOM Elements use Literal XML encoding For example if a service accepts one StringParameter and returns an Element just set the encoding style for the call tohttpxmlapacheorgxml-soapliteralxml and the encoding style for the parameter tohttpschemasxmlsoaporgsoapencoding Thus part of your client code would looklike Call call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML ) String strparam = joebobVector params = new Vector() paramsaddElement( newParameter( strparam Stringclass strparamConstantsNS_URI_SOAP_ENC ) )

Service Handlers

bull What is an actor

Every SOAP message has primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipient

SOAP allows Header entries to be addressed to specific actors with the

The Apache SOAP Project Documentation

Page 12Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP-ENVactor attribute This attribute contains the URI that uniquely identifies theactor

bull What tools are available that use Apache SOAP

Brought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format thatdescribe SOAP services There is an IBM alphaWorks toolkit that generates Java serviceclient libraries and service handler skeletons from a WSDL document See the WSDLspecification and the IBM toolkit

bull How do I get the samples installed

For Tomcat put the soapjar and samples classes on the system classpath (ie in$TOMCAT_HOMEclasseslib) rather than in webappssoapWEB-INF

bull I am having problems configuring SOAP with Webspere

Apache SOAP has worked under every version of WebSphere from 11 to 302 It willhowever work out of the box on WebSphere 35 with fixpak 2 applied The WebSphereinstall instructions for that level are part of the current SOAP kit You can browse themonline Be sure to check the following items

1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even ifit is default(80) just mention it in the URL ashttpaaabbbcccdddportsoapservletrpcrouter

2 Verify that xerces is at the start of your path not only by setting it in the App but alsoin the websphere configuration files (adminconfig setupclientbat)

bull Does Apache SOAP work with Microsoft SOAP

Yes but you need to install a patch to the MS SOAP package One of the well-knowninteroperability problems between Apache 20 and MS Soap is that MS clients do notsend type information with each parameter and the Apache soap server will reject suchrequests

James Snell has provided a patch adding the typing It can be found at SOAP-WRC website

22 Apache-SOAP Users FAQ

221 Apache-SOAP Users FAQ

This FAQ is based on the questions and answers that appear on the Apache-SOAP UsersMailing ListIt is currently maintained by Jonathan Chawke and was last modified on Sat 15-Mar-20031227 GMT

The Apache SOAP Project Documentation

Page 13Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Corrections and suggestions for new questions are always welcome

Table of Contents Hot Topics This section answers questions that have beenappearing frequently on the mailing list11 Help Im getting this error Element must contain afaultcode element12 Help Im getting this error Unable to resolve namespace URI for xsd13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP service14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not found15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodError16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAP19 How can I view the raw XML data that is exchanged between a SOAP client andserver110 I cant get SOAP working with Tomcat 4 (Catalina) Help

General This section answers general questions21 Where can I get help on SOAP issue XYZ22 Where can I find mailing list archives for the soap-user mailing list23 Im just getting started with SOAP Where can I find a tutorial on SOAP programming24 Are there any other SOAP FAQs available25 Where can I download the SOAP specification document(s)26 Are there any good books on SOAP27 What other SOAP implementations are available28 What is meant by the phrase SOAP is a wire-level protocol29 How does SOAP compare with other XML protocols210 How do I use TcpTunnel and TcpTunnelGUI211 How do I use SOAP over SSL212 How do I use SOAP over SMTP213 What products are available that will let me use ASP or Perl as SOAP client214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could use215 Where do I find nightly builds of the POP3 and SMTP beans218 Is there a way to generate SOAP stubskeleton code from a deployment descriptor219 Is there a way to generate SOAP deployment descriptor from IDL

The Apache SOAP Project Documentation

Page 14Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

220 Is there any way of specifying a timeout for a SOAP method invocation222 Are there any ISPs that will host SOAP applications224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh start228 How do I tell my Apache SOAP client to use a proxy server229 How do I perform Proxy Authentication with my Apache SOAP client230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy server231 Are there any commercially ready servlet containers which will support Apache SOAPclients 232 Where can I find a list of public SOAP services that are available on the Internet234 What tools are available that use Apache SOAP236 How do I restrict access to the Apache SOAP administration client238 How can I get the IP address of a client that is using my SOAP Service240 Can a client programmatically deploy a SOAP service241 Id like to deploy multiple services using a single deployment descriptor file Is thispossible242 Will Apache SOAP support JAXM when its ready243 Will Apache SOAP support JAX-RPC

InstallationThis section helps resolve questions which arise when installing ApacheSOAP in a particular application server environment31 What jar files do I need to provide for Apache-SOAP clients32 How do I install Apache-SOAP on Tomcat 3x33 Can I install Apache-SOAP 21 on Tomcat 4034 How do I install Apache-SOAP on Bea WebLogic 5135 How do I install Apache-SOAP on Bea WebLogic 6036 How do I install Apache-SOAP on Bea WebLogic 61 beta37 How do I install Apache-SOAP on Resin38 How do I install Apache-SOAP on IBM WebSphere39 How do I install Apache-SOAP on Bluestone310 How do I install Apache-SOAP on Orion311 How do I install Apache-SOAP on Apache-JServ312 How do I install Apache-SOAP on iPlanet Web Server313 How do I install Apache-SOAP on iPlanet Application Server314 How do I install Apache-SOAP on Unifys ServletExec316 How do I install Apache-SOAP on Oracle 8i Application Server318 How do I install Apache-SOAP on Borland Application Server (BAS) 45

Troubleshooting This section answers general troubleshooting queries42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijob

The Apache SOAP Project Documentation

Page 15Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 4: The Apache SOAP Project Documentation

161 June 10 2002 - Version 231

Added logic to use xsinil instead of xsinull when using the 2001 Schema specFixed behavior when the 1999 or 2000 schema URI is specified so that theserialization logic uses the older version of both the xsi and the xsd namespaces itwas previously just using the older xsd namespace

162 May 31 2002 - Version 23

Changed default schema to 2001 spec Reflected timeInstant -gt dateTime change in2001 schema spec Added support for primitive XSD data type hexBinary Addedsupport for 2001base64Binary Added HTTPS proxy support Made severalchanges to reduce the overhead of a SOAPMappingRegistry creation and also toreduce the number of SMRs created Removed SMR constructor which took theschema namespace URI because it doesnt work (newing an SMR with the desiredURI isnt enough to make the entire thing use that schema URI) Added agetParent() method to SOAPMappingRegistry to allow the registry tree to bewalked-up Added a test to the SOAPMappingRegistry so that null strings getserialized correctly Fixed a bug that prevents the default encoding from beingcorrectly applied in the SOAPMappingRegistry The SOAPMappingRegistry class asubclass of XMLJavaMappingRegistry now supports chaining ie an instance has aparent with the parent being null for the root instance When looking up amapping the chain is followed if necessary to resolve the mapping TheXMLJavaMappingRegistry class has a method setDefaultEncodingStyle which setsthe default encoding style When this method is called on a SOAPMappingRegistryinstance the default encoding style is set only for the particular link in the chain It isnot set for the parent (and recursively for all parents) This breaks the properapplication of the default Fixed encoding in SOAPHTTPConnection for systemswhose default codepage is not 8859_1 Add deployment descriptor to the bag inSOAPContext so people can query the data in it Fixed the popPollDelay constructorargument in SOAPSMTPConnection so that it is no longer being ignored Put theport number back in the HTTP host header Fixed the behavior ofExceptionFaultListener It was previously not looking in the right place for the type ofthe detail entry to be unmarshalled It was also not printing the encodingStyleattribute Within SOAPException the fault code and exception message will now berun through UtilscleanString() to escape special characters Clean stacktracebacks In particular constructors appear in stack tracebacks as ltinitgt methodsFixed the deployment descriptor so javaType= doesnt get output if the value is nullFixed a bug that prevented a services method from taking a Hashtable array orVector as a parameter while returning a DOM Element Fixed the documentationand code for the Base64 class so that they match and so that encode uses its lenparameter correctly Fixed a bug that prevented the client from using aBeanSerializer to serialize SOAP-encoded parameters within a Call labeled with the

The Apache SOAP Project Documentation

Page 4Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

literalXML encoding style The BooleanDeserializer has been updated to be veryliberal in what it will accept per the spec 0 and 1 are valid boolean values (and infact are the ones used by the WhiteMesa implementation) Synchronized calls toDateFormats methods since DateFormat appears to not be thread-safe Serializedates without losing precision (the JDK format is contains milliseconds) Deserializedates with any number of digits of fractional seconds and with or without a timezone offset Fixed a NullPointerException that was being thrown when a DataSourcewas passed as the source parameter within the MimePartSerializer Started to addthe ability to serialize elements with qualified names If PrefixedName objects arenot explicitly used as the context arguments for serialization the behavior is exactlythe same as it was before Fixed a bug in the EJB providers which printed out thewrong error message Changed context intialization within the EJB providers to allowthe specification of the PROVIDER_URL and INITIAL_CONTEXT_FACTORYseparately Put in the non-debug version of the COM provider Added a method toremove a body part from a Call object Fixed a problem that would cause a Callobjects targetObjectURI property to get set to null if a Fault was returned Pass theactual encoding style on the Call constructor Solves a literal XML interop problemwith pocket soap Fixed a bug that was causing an attribute to be printed without aclosing The DeploymentDescriptor will now allow a TypeMapping to be specifiedwithout the elementType Made the DeploymentDescriptor and TypeMappingsserializingdeserializing logic more tolerant of null values Fixed theDeploymentDescriptortoString() method to correctly display the TypeMappingsRemoved debug println from the DeploymentDescriptor Add support for opts onjava and script services in the ddxml file A type-check was not being performed inthe ServiceManager due to its placement It has been moved so that it now haseffect Added support for setting the configuration file name as a Web applicationcontext parameter so that it will be picked up by the JSPs as well as the routerservlets This will fix the problem of the JSPs using the default ConfigManangerwhen one has been specified for the router servlets Fixed problem of attempting tostore null as the classloader in the servlet attributes Made the servlets store theclassloader from the thread instead of theirs Removed 2 server-side stack tracesfrom the servlets where exceptions were also being propagated Made theServerHTTPUtilsreadEnvelopeFromRequest() method public instead of thedefault package access The code will now only store the target object in theServletContext or HTTPSession when it is newly created and will not store it oneach invocation Added a patch to SOAPHTTPConnection that makes the set-cookieand set-cookie2 header searches case-insensitive Fixed exceptions that are thrownfrom HTTPUtils so that they contain more helpful messages Ensure request URIcontains at least one character Fixed a StringOutOfBoundsException that wasbeing thrown when a server returned a header with no value to an Apache SOAPclient Added a method to DOMUtils to retrieve qualified attribute value That is it willreturna QName representing the value of the requested attribute Fixed a problem

The Apache SOAP Project Documentation

Page 5Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

with QName that Was causing it to throw a NullPointerException if localPartconstructor arg was null Fixed a missing closing ltagt tag in listjsp Build now allowsdist target to build when ejb is not present Added support for config file element toallow users to enable or disable SOAP interface to Service Manager Changed allsamples to use the Fault classs toString() method instead of calling thegetFaultCode() and getFaultString() methods This will cause the samples to displayall the fault information and not just parts of it Added a new calculator demo thatsimulates a reverse polish notation calculator Fixed the EJB sample so that thecorrect parameters are passed to the EJB method Fixed up the interop sample andadded support for the echoMap service Updated to reflect Java 12+ requirementFixed some typos in the documentation Fixed WAS 35 instructions for using thecorrect Xerces JAR Updated deployment descriptor schema to reflect the mappingQName being made optional Made the XMLParserUtilsgetXMLDocBuilder()method synchronized Added support for turning off Nagles algorithm under TCP(HTTP) Fixed ArraySerializer to recognize null items when unmarshalling Changedunmarshalling of xsinull to be just as liberal as BooleanDeserializer is in what itaccepts

163 May 30 2001 - Version 22

Changed all code and samples to use JAXP no longer bound to Xerces Removedmany printlns from the server-side code replacing them with thrown Exceptions Asoapwar Web Application Archive is now included in the distribution for easierdeployment to Servlet containers Included SSL (on Tomcat) doc and linked to itfrom the Installation page Added support for serializingdeserializing javautilMapsAdded support for serializingdeserializing BigDecimal lt--gt xsddecimal Removednon-threadsafe private variables from Servlets If a service method with a matchingsignature is not found a second search is done for a method with an additional (first)parameter of type SOAPContext Users Guide has been re-worked and updatedCOM sample has been updated Added a BEA WebLogic EJB sample Changed theEJB providers so that it grabs the JNDIName from one of the options instead offrom the java class= section of the deployment descriptor For backwardscompatibility if it doesnt find it in the options section (using key=JNDIName) then itwill look in the old java class= section Added an XMLConfigManager Added aBaseConfigManager (to make authoring ConfigManagers easier) Added aworkaround to orgapachesoapFault to enable it to work with Xerces 131 andlater It will now accept a return value of from NodegetNamespaceURI() insteadof just accepting null or a non-empty String Fixed a bug when deserializing nulls oftype ur-type which are generated when the VectorSerializer finds nulls inside aVector Removed requirement of ltjavagt tag in deployment descriptor when usingpluggable providers Fixed a bug where a 400 error code was being returned insteadof the 500 required by SOAP Fixed a bug in header parsing code it was assumingthat a space existed after the character Unmarshalling logic now understands

The Apache SOAP Project Documentation

Page 6Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

1999 2000 and 2001 Schema simple types Unmarshalling logic can nowdeserialize payload with IDHREF attributes RPCRouter can now throw aSOAPException if the checkMustUnderstand property is set on theDeploymentDescriptor and a mustUnderstand=1 attribute is found on a headerThe output buffer size can now be explicitly set on the SOAPHTTPConnectionAdded HTTP proxy basic authentication support The SOAPHTTPConnection nowhas a maintainSession property which when true will cause theSOAPHTTPConnection to return the appropriate cookies with requests It is true bydefault Added a default encoding style property to SOAPMappingRegistry to beused when no encoding style is specified Removed special treatment of CDATAsections in the code that inserts escape sequences The code will now round tripStrings correctly whether they contain CDATA sections or not All the simplenumeric types now use a serializer that does not run its content throughUtilscleanString(String) Cleaned up handling of servlet init-parameters inRPCRouterServlet and MessageRouterServlet Removed transport hook systemproperty dependency The only remaining call to SystemgetProperty(String) is to getlineseparator This should help with some of the security constraints for Appletsand the like Removed some extraneous methods fromorgapachesoaputilStringUtils Put 2 lines back into XMISerializer andXMIDeserializer (the same 1 line in each actually) to enable them to work with thexmisoapjar which is posted on the site These lines were originally there but wereremoved to try to work with the latestXMI version For now the code works with theposted version Added the BidBuy interoperability sample MadeDateSerializerunmarshall() a little more lenient so that it handles parsing dateswith and without milliseconds specified Added a Troubleshooting table and a link toit from the front page Added an Interoperability section to the Users Guide Added aMigration section to the Users Guide Fixed a bug in StatelessEJBProvider andStatefulEJBProvider where the respEncStyle was being set but not used InRPCRouterServletdoGet() and MessageRouterServletdoGet() movedressetContentType() call before resgetWriter() call to be in compliance withServlet spec Added install docs for iPlanet

164 February 5 2001 - Version 21

Added Message Handling Support Added configurable error handling mechanismAdded pluggable provider support Added client-side HTTPS support Added HTTPproxy support Added HTTP basic authentication support Added support for SOAPMessages with Attachments Introduced SOAPContext Added support for transporthooks Added SSL support Reduced dependency on xsitype for deserializationAdded soap configuration file Added pluggable configuration manager Addedsupport for international character sets Added support for defaultserializationdeserialization of Hashtable (as xmlsoapMap) Date (asxsdtimeInstant) GregorianCalendar (as xsddate)

The Apache SOAP Project Documentation

Page 7Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

165 August 18 2000 - Version 20

Deprecated the rpcrouterjsp in favor of an RPCRouter servlet Steven J McDowallNoor Zaman Sanjiva Weerawarana Switched the stockquote demos provider fromwwwi3solutionscom to wwwxmltodaycom Sam Ruby Restructureddocumentation Sanjiva Weerawarana The serializer for javalangString now runs itscontent through UtilscleanString() to escape necessary characters Matthew JDuftler Added a distribution containing the source Matthew J Duftler Created a newsoap webapp Provides access to the web-based admin client and the rpcrouterservlet Sanjiva Weerawarana Changed remaining IBM-SOAP references toApache-SOAP Wouter Cloetens Mike Paolini Matthew J Duftler Added a serializerfor Vectors and Enumerations Glen Daniels Removed trailing in XSD and XSInamespace URIs Steven J McDowall The unmarshalling logic in Fault will nowaccept the SOAP-ENV namespace URI in addition to the old accepted behavior ofno namespace URI at all when processing subelements of Fault Steven JMcDowall Matthew J Duftler HTTPUtilspost() will now use port 80 if no port isspecified Steven J McDowall Fixed a bug that occurred when aServiceManagerClient was instantiated and used to make several invocations Theproblem was when there were no params the params property of the Call objectwas not being set to null Peter Brittenham Matthew J Duftler AddedgetAttributeNS() to DOMUtils It has similar behavior to DOMUtilsgetAttribute()DOMUtilsgetAttributeNS() will return null if there is no specified or default attributevalue Matthew J Duftler Fixed HTTP code to use rn instead of println for lineendings Kevin J Mitchell An array of bytes (ie byte[]) will now be serialized into aSOAP-ENCbase64 type A SOAP-ENCbase64 type will also now be deserializedinto a byte array (ie byte[]) Matthew J Duftler Sanjiva Weerawarana Removedextraneous references to BML namespace URI from deployjsp SanjivaWeerawarana

166 June 4 2000 - Version 12

Created initial code base from IBM-SOAP

2 FAQ

21 Apache SOAP Frequently Asked Questions (FAQ)

211 Apache SOAP Frequently Asked Questions (FAQ)

I have composed this list of questions partly from my own learning process and partly by

The Apache SOAP Project Documentation

Page 8Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

perusing questions from the SOAP User mailing list Corrections and suggestions for newquestions are always welcome Please forward new questions - preferably with answers - orerrors to the SOAP Developer mailing list

See also

bull Messaging The transport part of the XML puzzle by Gordon Van Huizenbull XML Protocol Comparisons produced by the W3Cbull Also see the SOAP FAQ maintained by Developmentorbull A Quick-Start Guide for Installing Apache SOAP by XMethodsbull Jonathan Chawkes SOAP FAQ which will eventually be merged with this FAQ and

hosted on the Apache SOAP web-sitebull SOAP and SMTP FAQ by Jonathan Chawkebull Apache SOAP and WebLogic 61Beta by Steve Livingstonbull Some info on RPC response encoding styles by Matthew J Duftler and Dirck Hecking

Namespaces

bull What are all these SOAP Namespaces

SOAP uses a few different namespaces for different elements and attributes depending onthe role that the data item in question plays in the message formatting handling andorencoding Looking at the Envelope element of a typical SOAP message we see thefollowing namespace declarations

1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchema

where 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) isthe XML Schema Instance namespace and 4) is the XML Schema Definition namespaceSOAP defines the first two namespaces and refers to the second two These namespacesreflect how all data type definitions in SOAP are delegated to XML Schema

The SOAP Envelope namespace defines the Envelope Header and Body elementnames and the encodingStyle actor and mustUnderstand attributes

The SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommendedfor any linear list of objects Ie Java 2 Collection objects can and probably should usethis encoding approach

The XML Schema Instance namespace defines the type attribute which identifies thedata type of an element

The Apache SOAP Project Documentation

Page 9Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

The XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

bull Do I need to use namespaces on my XML data

The short answer is yes but only a little

The long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements thoseelement names will have to be namespace qualified

Although it is technically possible to just use one of the SOAP namespaces it probablyisnt a good idea unless the element name is actually defined in that namespace (iedefined by the SOAP specification)

If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URIwhen you register an element name See Serialization below

bull What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

The Apache SOAP library will generate namespace prefixes as needed to make sure thatall necessary namespaces are declared If the same namespace gets declared twice withtwo different prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local partof the element name (the part after the prefix)

ltSOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacegt ltns3GetData xmlnsns3=urnacmecorpcomnamespacegtltns3GetDatagt

In this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

Serialization

bull How do I send user defined java objects using SOAP

You need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)

Although not required by the SOAP specification the Apache library requires that allXML Elements be namespace qualified via the QName utility class You can use (almost)

The Apache SOAP Project Documentation

Page 10Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

anything for the QName You might think of the first piece as a path and the secondpiece as a SOAP object You might want to use something like the following

SOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENC newQName(urnmyowncomobjects MyObject) ObjectclassmyObjSer myObjSer )

Then when you deploy the service that you are calling you must have a mapping entrythat looks something like the following

ltisdmapencodingStyle=httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializergt

On the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server touse the bean serializer to translate it into a urnmyowncomobjectsMyObject SOAPobject and send it to the client

One the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like touse the serializer called myObjSer to translate the SOAP object into a Java MyObjectobject

The main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use inyour QName object

Note that it is often not necessary to write your own Serializer or Deserializer If yourclass has a get and a set for each attribute that needs to be marshalled you can just usethe Apache SOAP BeanSerializer class

bull What are the different SOAP encoding styles Which should I use

The Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserialzier for anXML element

The SOAP specification allows the encodingStyle attribute to hold multiple URIswhich denote increasingly general encoding rules What isnt defined however is how a

The Apache SOAP Project Documentation

Page 11Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP processor is to determine which encoding style to apply Consequently theApache SOAP library does not support this syntax and will always treat theencodingStyle attribute value as a single URI reference

1 SOAP Encoding

This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully insection 5 of the SOAP specification

2 XMI Encoding3 Literal XML Encoding

bull How do you serialize javautilDate objects

Use BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializeris planned that serializes using the ISO date format

Date objects should be converted to xsddate or xsdtimeInstant to be SOAPcompliant The SOAP spec says For simple types SOAP adopts all the types found inthe section Built-in datatypes of the XML Schema Part 2 Datatypes but not all havebeen implemented

bull How do you return a DOM Element from an RPC Call

The encoding style of a Call return is determined by the encoding style of the RequestDOM Elements use Literal XML encoding For example if a service accepts one StringParameter and returns an Element just set the encoding style for the call tohttpxmlapacheorgxml-soapliteralxml and the encoding style for the parameter tohttpschemasxmlsoaporgsoapencoding Thus part of your client code would looklike Call call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML ) String strparam = joebobVector params = new Vector() paramsaddElement( newParameter( strparam Stringclass strparamConstantsNS_URI_SOAP_ENC ) )

Service Handlers

bull What is an actor

Every SOAP message has primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipient

SOAP allows Header entries to be addressed to specific actors with the

The Apache SOAP Project Documentation

Page 12Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP-ENVactor attribute This attribute contains the URI that uniquely identifies theactor

bull What tools are available that use Apache SOAP

Brought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format thatdescribe SOAP services There is an IBM alphaWorks toolkit that generates Java serviceclient libraries and service handler skeletons from a WSDL document See the WSDLspecification and the IBM toolkit

bull How do I get the samples installed

For Tomcat put the soapjar and samples classes on the system classpath (ie in$TOMCAT_HOMEclasseslib) rather than in webappssoapWEB-INF

bull I am having problems configuring SOAP with Webspere

Apache SOAP has worked under every version of WebSphere from 11 to 302 It willhowever work out of the box on WebSphere 35 with fixpak 2 applied The WebSphereinstall instructions for that level are part of the current SOAP kit You can browse themonline Be sure to check the following items

1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even ifit is default(80) just mention it in the URL ashttpaaabbbcccdddportsoapservletrpcrouter

2 Verify that xerces is at the start of your path not only by setting it in the App but alsoin the websphere configuration files (adminconfig setupclientbat)

bull Does Apache SOAP work with Microsoft SOAP

Yes but you need to install a patch to the MS SOAP package One of the well-knowninteroperability problems between Apache 20 and MS Soap is that MS clients do notsend type information with each parameter and the Apache soap server will reject suchrequests

James Snell has provided a patch adding the typing It can be found at SOAP-WRC website

22 Apache-SOAP Users FAQ

221 Apache-SOAP Users FAQ

This FAQ is based on the questions and answers that appear on the Apache-SOAP UsersMailing ListIt is currently maintained by Jonathan Chawke and was last modified on Sat 15-Mar-20031227 GMT

The Apache SOAP Project Documentation

Page 13Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Corrections and suggestions for new questions are always welcome

Table of Contents Hot Topics This section answers questions that have beenappearing frequently on the mailing list11 Help Im getting this error Element must contain afaultcode element12 Help Im getting this error Unable to resolve namespace URI for xsd13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP service14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not found15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodError16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAP19 How can I view the raw XML data that is exchanged between a SOAP client andserver110 I cant get SOAP working with Tomcat 4 (Catalina) Help

General This section answers general questions21 Where can I get help on SOAP issue XYZ22 Where can I find mailing list archives for the soap-user mailing list23 Im just getting started with SOAP Where can I find a tutorial on SOAP programming24 Are there any other SOAP FAQs available25 Where can I download the SOAP specification document(s)26 Are there any good books on SOAP27 What other SOAP implementations are available28 What is meant by the phrase SOAP is a wire-level protocol29 How does SOAP compare with other XML protocols210 How do I use TcpTunnel and TcpTunnelGUI211 How do I use SOAP over SSL212 How do I use SOAP over SMTP213 What products are available that will let me use ASP or Perl as SOAP client214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could use215 Where do I find nightly builds of the POP3 and SMTP beans218 Is there a way to generate SOAP stubskeleton code from a deployment descriptor219 Is there a way to generate SOAP deployment descriptor from IDL

The Apache SOAP Project Documentation

Page 14Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

220 Is there any way of specifying a timeout for a SOAP method invocation222 Are there any ISPs that will host SOAP applications224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh start228 How do I tell my Apache SOAP client to use a proxy server229 How do I perform Proxy Authentication with my Apache SOAP client230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy server231 Are there any commercially ready servlet containers which will support Apache SOAPclients 232 Where can I find a list of public SOAP services that are available on the Internet234 What tools are available that use Apache SOAP236 How do I restrict access to the Apache SOAP administration client238 How can I get the IP address of a client that is using my SOAP Service240 Can a client programmatically deploy a SOAP service241 Id like to deploy multiple services using a single deployment descriptor file Is thispossible242 Will Apache SOAP support JAXM when its ready243 Will Apache SOAP support JAX-RPC

InstallationThis section helps resolve questions which arise when installing ApacheSOAP in a particular application server environment31 What jar files do I need to provide for Apache-SOAP clients32 How do I install Apache-SOAP on Tomcat 3x33 Can I install Apache-SOAP 21 on Tomcat 4034 How do I install Apache-SOAP on Bea WebLogic 5135 How do I install Apache-SOAP on Bea WebLogic 6036 How do I install Apache-SOAP on Bea WebLogic 61 beta37 How do I install Apache-SOAP on Resin38 How do I install Apache-SOAP on IBM WebSphere39 How do I install Apache-SOAP on Bluestone310 How do I install Apache-SOAP on Orion311 How do I install Apache-SOAP on Apache-JServ312 How do I install Apache-SOAP on iPlanet Web Server313 How do I install Apache-SOAP on iPlanet Application Server314 How do I install Apache-SOAP on Unifys ServletExec316 How do I install Apache-SOAP on Oracle 8i Application Server318 How do I install Apache-SOAP on Borland Application Server (BAS) 45

Troubleshooting This section answers general troubleshooting queries42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijob

The Apache SOAP Project Documentation

Page 15Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 5: The Apache SOAP Project Documentation

literalXML encoding style The BooleanDeserializer has been updated to be veryliberal in what it will accept per the spec 0 and 1 are valid boolean values (and infact are the ones used by the WhiteMesa implementation) Synchronized calls toDateFormats methods since DateFormat appears to not be thread-safe Serializedates without losing precision (the JDK format is contains milliseconds) Deserializedates with any number of digits of fractional seconds and with or without a timezone offset Fixed a NullPointerException that was being thrown when a DataSourcewas passed as the source parameter within the MimePartSerializer Started to addthe ability to serialize elements with qualified names If PrefixedName objects arenot explicitly used as the context arguments for serialization the behavior is exactlythe same as it was before Fixed a bug in the EJB providers which printed out thewrong error message Changed context intialization within the EJB providers to allowthe specification of the PROVIDER_URL and INITIAL_CONTEXT_FACTORYseparately Put in the non-debug version of the COM provider Added a method toremove a body part from a Call object Fixed a problem that would cause a Callobjects targetObjectURI property to get set to null if a Fault was returned Pass theactual encoding style on the Call constructor Solves a literal XML interop problemwith pocket soap Fixed a bug that was causing an attribute to be printed without aclosing The DeploymentDescriptor will now allow a TypeMapping to be specifiedwithout the elementType Made the DeploymentDescriptor and TypeMappingsserializingdeserializing logic more tolerant of null values Fixed theDeploymentDescriptortoString() method to correctly display the TypeMappingsRemoved debug println from the DeploymentDescriptor Add support for opts onjava and script services in the ddxml file A type-check was not being performed inthe ServiceManager due to its placement It has been moved so that it now haseffect Added support for setting the configuration file name as a Web applicationcontext parameter so that it will be picked up by the JSPs as well as the routerservlets This will fix the problem of the JSPs using the default ConfigManangerwhen one has been specified for the router servlets Fixed problem of attempting tostore null as the classloader in the servlet attributes Made the servlets store theclassloader from the thread instead of theirs Removed 2 server-side stack tracesfrom the servlets where exceptions were also being propagated Made theServerHTTPUtilsreadEnvelopeFromRequest() method public instead of thedefault package access The code will now only store the target object in theServletContext or HTTPSession when it is newly created and will not store it oneach invocation Added a patch to SOAPHTTPConnection that makes the set-cookieand set-cookie2 header searches case-insensitive Fixed exceptions that are thrownfrom HTTPUtils so that they contain more helpful messages Ensure request URIcontains at least one character Fixed a StringOutOfBoundsException that wasbeing thrown when a server returned a header with no value to an Apache SOAPclient Added a method to DOMUtils to retrieve qualified attribute value That is it willreturna QName representing the value of the requested attribute Fixed a problem

The Apache SOAP Project Documentation

Page 5Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

with QName that Was causing it to throw a NullPointerException if localPartconstructor arg was null Fixed a missing closing ltagt tag in listjsp Build now allowsdist target to build when ejb is not present Added support for config file element toallow users to enable or disable SOAP interface to Service Manager Changed allsamples to use the Fault classs toString() method instead of calling thegetFaultCode() and getFaultString() methods This will cause the samples to displayall the fault information and not just parts of it Added a new calculator demo thatsimulates a reverse polish notation calculator Fixed the EJB sample so that thecorrect parameters are passed to the EJB method Fixed up the interop sample andadded support for the echoMap service Updated to reflect Java 12+ requirementFixed some typos in the documentation Fixed WAS 35 instructions for using thecorrect Xerces JAR Updated deployment descriptor schema to reflect the mappingQName being made optional Made the XMLParserUtilsgetXMLDocBuilder()method synchronized Added support for turning off Nagles algorithm under TCP(HTTP) Fixed ArraySerializer to recognize null items when unmarshalling Changedunmarshalling of xsinull to be just as liberal as BooleanDeserializer is in what itaccepts

163 May 30 2001 - Version 22

Changed all code and samples to use JAXP no longer bound to Xerces Removedmany printlns from the server-side code replacing them with thrown Exceptions Asoapwar Web Application Archive is now included in the distribution for easierdeployment to Servlet containers Included SSL (on Tomcat) doc and linked to itfrom the Installation page Added support for serializingdeserializing javautilMapsAdded support for serializingdeserializing BigDecimal lt--gt xsddecimal Removednon-threadsafe private variables from Servlets If a service method with a matchingsignature is not found a second search is done for a method with an additional (first)parameter of type SOAPContext Users Guide has been re-worked and updatedCOM sample has been updated Added a BEA WebLogic EJB sample Changed theEJB providers so that it grabs the JNDIName from one of the options instead offrom the java class= section of the deployment descriptor For backwardscompatibility if it doesnt find it in the options section (using key=JNDIName) then itwill look in the old java class= section Added an XMLConfigManager Added aBaseConfigManager (to make authoring ConfigManagers easier) Added aworkaround to orgapachesoapFault to enable it to work with Xerces 131 andlater It will now accept a return value of from NodegetNamespaceURI() insteadof just accepting null or a non-empty String Fixed a bug when deserializing nulls oftype ur-type which are generated when the VectorSerializer finds nulls inside aVector Removed requirement of ltjavagt tag in deployment descriptor when usingpluggable providers Fixed a bug where a 400 error code was being returned insteadof the 500 required by SOAP Fixed a bug in header parsing code it was assumingthat a space existed after the character Unmarshalling logic now understands

The Apache SOAP Project Documentation

Page 6Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

1999 2000 and 2001 Schema simple types Unmarshalling logic can nowdeserialize payload with IDHREF attributes RPCRouter can now throw aSOAPException if the checkMustUnderstand property is set on theDeploymentDescriptor and a mustUnderstand=1 attribute is found on a headerThe output buffer size can now be explicitly set on the SOAPHTTPConnectionAdded HTTP proxy basic authentication support The SOAPHTTPConnection nowhas a maintainSession property which when true will cause theSOAPHTTPConnection to return the appropriate cookies with requests It is true bydefault Added a default encoding style property to SOAPMappingRegistry to beused when no encoding style is specified Removed special treatment of CDATAsections in the code that inserts escape sequences The code will now round tripStrings correctly whether they contain CDATA sections or not All the simplenumeric types now use a serializer that does not run its content throughUtilscleanString(String) Cleaned up handling of servlet init-parameters inRPCRouterServlet and MessageRouterServlet Removed transport hook systemproperty dependency The only remaining call to SystemgetProperty(String) is to getlineseparator This should help with some of the security constraints for Appletsand the like Removed some extraneous methods fromorgapachesoaputilStringUtils Put 2 lines back into XMISerializer andXMIDeserializer (the same 1 line in each actually) to enable them to work with thexmisoapjar which is posted on the site These lines were originally there but wereremoved to try to work with the latestXMI version For now the code works with theposted version Added the BidBuy interoperability sample MadeDateSerializerunmarshall() a little more lenient so that it handles parsing dateswith and without milliseconds specified Added a Troubleshooting table and a link toit from the front page Added an Interoperability section to the Users Guide Added aMigration section to the Users Guide Fixed a bug in StatelessEJBProvider andStatefulEJBProvider where the respEncStyle was being set but not used InRPCRouterServletdoGet() and MessageRouterServletdoGet() movedressetContentType() call before resgetWriter() call to be in compliance withServlet spec Added install docs for iPlanet

164 February 5 2001 - Version 21

Added Message Handling Support Added configurable error handling mechanismAdded pluggable provider support Added client-side HTTPS support Added HTTPproxy support Added HTTP basic authentication support Added support for SOAPMessages with Attachments Introduced SOAPContext Added support for transporthooks Added SSL support Reduced dependency on xsitype for deserializationAdded soap configuration file Added pluggable configuration manager Addedsupport for international character sets Added support for defaultserializationdeserialization of Hashtable (as xmlsoapMap) Date (asxsdtimeInstant) GregorianCalendar (as xsddate)

The Apache SOAP Project Documentation

Page 7Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

165 August 18 2000 - Version 20

Deprecated the rpcrouterjsp in favor of an RPCRouter servlet Steven J McDowallNoor Zaman Sanjiva Weerawarana Switched the stockquote demos provider fromwwwi3solutionscom to wwwxmltodaycom Sam Ruby Restructureddocumentation Sanjiva Weerawarana The serializer for javalangString now runs itscontent through UtilscleanString() to escape necessary characters Matthew JDuftler Added a distribution containing the source Matthew J Duftler Created a newsoap webapp Provides access to the web-based admin client and the rpcrouterservlet Sanjiva Weerawarana Changed remaining IBM-SOAP references toApache-SOAP Wouter Cloetens Mike Paolini Matthew J Duftler Added a serializerfor Vectors and Enumerations Glen Daniels Removed trailing in XSD and XSInamespace URIs Steven J McDowall The unmarshalling logic in Fault will nowaccept the SOAP-ENV namespace URI in addition to the old accepted behavior ofno namespace URI at all when processing subelements of Fault Steven JMcDowall Matthew J Duftler HTTPUtilspost() will now use port 80 if no port isspecified Steven J McDowall Fixed a bug that occurred when aServiceManagerClient was instantiated and used to make several invocations Theproblem was when there were no params the params property of the Call objectwas not being set to null Peter Brittenham Matthew J Duftler AddedgetAttributeNS() to DOMUtils It has similar behavior to DOMUtilsgetAttribute()DOMUtilsgetAttributeNS() will return null if there is no specified or default attributevalue Matthew J Duftler Fixed HTTP code to use rn instead of println for lineendings Kevin J Mitchell An array of bytes (ie byte[]) will now be serialized into aSOAP-ENCbase64 type A SOAP-ENCbase64 type will also now be deserializedinto a byte array (ie byte[]) Matthew J Duftler Sanjiva Weerawarana Removedextraneous references to BML namespace URI from deployjsp SanjivaWeerawarana

166 June 4 2000 - Version 12

Created initial code base from IBM-SOAP

2 FAQ

21 Apache SOAP Frequently Asked Questions (FAQ)

211 Apache SOAP Frequently Asked Questions (FAQ)

I have composed this list of questions partly from my own learning process and partly by

The Apache SOAP Project Documentation

Page 8Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

perusing questions from the SOAP User mailing list Corrections and suggestions for newquestions are always welcome Please forward new questions - preferably with answers - orerrors to the SOAP Developer mailing list

See also

bull Messaging The transport part of the XML puzzle by Gordon Van Huizenbull XML Protocol Comparisons produced by the W3Cbull Also see the SOAP FAQ maintained by Developmentorbull A Quick-Start Guide for Installing Apache SOAP by XMethodsbull Jonathan Chawkes SOAP FAQ which will eventually be merged with this FAQ and

hosted on the Apache SOAP web-sitebull SOAP and SMTP FAQ by Jonathan Chawkebull Apache SOAP and WebLogic 61Beta by Steve Livingstonbull Some info on RPC response encoding styles by Matthew J Duftler and Dirck Hecking

Namespaces

bull What are all these SOAP Namespaces

SOAP uses a few different namespaces for different elements and attributes depending onthe role that the data item in question plays in the message formatting handling andorencoding Looking at the Envelope element of a typical SOAP message we see thefollowing namespace declarations

1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchema

where 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) isthe XML Schema Instance namespace and 4) is the XML Schema Definition namespaceSOAP defines the first two namespaces and refers to the second two These namespacesreflect how all data type definitions in SOAP are delegated to XML Schema

The SOAP Envelope namespace defines the Envelope Header and Body elementnames and the encodingStyle actor and mustUnderstand attributes

The SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommendedfor any linear list of objects Ie Java 2 Collection objects can and probably should usethis encoding approach

The XML Schema Instance namespace defines the type attribute which identifies thedata type of an element

The Apache SOAP Project Documentation

Page 9Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

The XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

bull Do I need to use namespaces on my XML data

The short answer is yes but only a little

The long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements thoseelement names will have to be namespace qualified

Although it is technically possible to just use one of the SOAP namespaces it probablyisnt a good idea unless the element name is actually defined in that namespace (iedefined by the SOAP specification)

If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URIwhen you register an element name See Serialization below

bull What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

The Apache SOAP library will generate namespace prefixes as needed to make sure thatall necessary namespaces are declared If the same namespace gets declared twice withtwo different prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local partof the element name (the part after the prefix)

ltSOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacegt ltns3GetData xmlnsns3=urnacmecorpcomnamespacegtltns3GetDatagt

In this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

Serialization

bull How do I send user defined java objects using SOAP

You need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)

Although not required by the SOAP specification the Apache library requires that allXML Elements be namespace qualified via the QName utility class You can use (almost)

The Apache SOAP Project Documentation

Page 10Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

anything for the QName You might think of the first piece as a path and the secondpiece as a SOAP object You might want to use something like the following

SOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENC newQName(urnmyowncomobjects MyObject) ObjectclassmyObjSer myObjSer )

Then when you deploy the service that you are calling you must have a mapping entrythat looks something like the following

ltisdmapencodingStyle=httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializergt

On the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server touse the bean serializer to translate it into a urnmyowncomobjectsMyObject SOAPobject and send it to the client

One the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like touse the serializer called myObjSer to translate the SOAP object into a Java MyObjectobject

The main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use inyour QName object

Note that it is often not necessary to write your own Serializer or Deserializer If yourclass has a get and a set for each attribute that needs to be marshalled you can just usethe Apache SOAP BeanSerializer class

bull What are the different SOAP encoding styles Which should I use

The Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserialzier for anXML element

The SOAP specification allows the encodingStyle attribute to hold multiple URIswhich denote increasingly general encoding rules What isnt defined however is how a

The Apache SOAP Project Documentation

Page 11Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP processor is to determine which encoding style to apply Consequently theApache SOAP library does not support this syntax and will always treat theencodingStyle attribute value as a single URI reference

1 SOAP Encoding

This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully insection 5 of the SOAP specification

2 XMI Encoding3 Literal XML Encoding

bull How do you serialize javautilDate objects

Use BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializeris planned that serializes using the ISO date format

Date objects should be converted to xsddate or xsdtimeInstant to be SOAPcompliant The SOAP spec says For simple types SOAP adopts all the types found inthe section Built-in datatypes of the XML Schema Part 2 Datatypes but not all havebeen implemented

bull How do you return a DOM Element from an RPC Call

The encoding style of a Call return is determined by the encoding style of the RequestDOM Elements use Literal XML encoding For example if a service accepts one StringParameter and returns an Element just set the encoding style for the call tohttpxmlapacheorgxml-soapliteralxml and the encoding style for the parameter tohttpschemasxmlsoaporgsoapencoding Thus part of your client code would looklike Call call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML ) String strparam = joebobVector params = new Vector() paramsaddElement( newParameter( strparam Stringclass strparamConstantsNS_URI_SOAP_ENC ) )

Service Handlers

bull What is an actor

Every SOAP message has primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipient

SOAP allows Header entries to be addressed to specific actors with the

The Apache SOAP Project Documentation

Page 12Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP-ENVactor attribute This attribute contains the URI that uniquely identifies theactor

bull What tools are available that use Apache SOAP

Brought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format thatdescribe SOAP services There is an IBM alphaWorks toolkit that generates Java serviceclient libraries and service handler skeletons from a WSDL document See the WSDLspecification and the IBM toolkit

bull How do I get the samples installed

For Tomcat put the soapjar and samples classes on the system classpath (ie in$TOMCAT_HOMEclasseslib) rather than in webappssoapWEB-INF

bull I am having problems configuring SOAP with Webspere

Apache SOAP has worked under every version of WebSphere from 11 to 302 It willhowever work out of the box on WebSphere 35 with fixpak 2 applied The WebSphereinstall instructions for that level are part of the current SOAP kit You can browse themonline Be sure to check the following items

1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even ifit is default(80) just mention it in the URL ashttpaaabbbcccdddportsoapservletrpcrouter

2 Verify that xerces is at the start of your path not only by setting it in the App but alsoin the websphere configuration files (adminconfig setupclientbat)

bull Does Apache SOAP work with Microsoft SOAP

Yes but you need to install a patch to the MS SOAP package One of the well-knowninteroperability problems between Apache 20 and MS Soap is that MS clients do notsend type information with each parameter and the Apache soap server will reject suchrequests

James Snell has provided a patch adding the typing It can be found at SOAP-WRC website

22 Apache-SOAP Users FAQ

221 Apache-SOAP Users FAQ

This FAQ is based on the questions and answers that appear on the Apache-SOAP UsersMailing ListIt is currently maintained by Jonathan Chawke and was last modified on Sat 15-Mar-20031227 GMT

The Apache SOAP Project Documentation

Page 13Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Corrections and suggestions for new questions are always welcome

Table of Contents Hot Topics This section answers questions that have beenappearing frequently on the mailing list11 Help Im getting this error Element must contain afaultcode element12 Help Im getting this error Unable to resolve namespace URI for xsd13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP service14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not found15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodError16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAP19 How can I view the raw XML data that is exchanged between a SOAP client andserver110 I cant get SOAP working with Tomcat 4 (Catalina) Help

General This section answers general questions21 Where can I get help on SOAP issue XYZ22 Where can I find mailing list archives for the soap-user mailing list23 Im just getting started with SOAP Where can I find a tutorial on SOAP programming24 Are there any other SOAP FAQs available25 Where can I download the SOAP specification document(s)26 Are there any good books on SOAP27 What other SOAP implementations are available28 What is meant by the phrase SOAP is a wire-level protocol29 How does SOAP compare with other XML protocols210 How do I use TcpTunnel and TcpTunnelGUI211 How do I use SOAP over SSL212 How do I use SOAP over SMTP213 What products are available that will let me use ASP or Perl as SOAP client214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could use215 Where do I find nightly builds of the POP3 and SMTP beans218 Is there a way to generate SOAP stubskeleton code from a deployment descriptor219 Is there a way to generate SOAP deployment descriptor from IDL

The Apache SOAP Project Documentation

Page 14Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

220 Is there any way of specifying a timeout for a SOAP method invocation222 Are there any ISPs that will host SOAP applications224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh start228 How do I tell my Apache SOAP client to use a proxy server229 How do I perform Proxy Authentication with my Apache SOAP client230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy server231 Are there any commercially ready servlet containers which will support Apache SOAPclients 232 Where can I find a list of public SOAP services that are available on the Internet234 What tools are available that use Apache SOAP236 How do I restrict access to the Apache SOAP administration client238 How can I get the IP address of a client that is using my SOAP Service240 Can a client programmatically deploy a SOAP service241 Id like to deploy multiple services using a single deployment descriptor file Is thispossible242 Will Apache SOAP support JAXM when its ready243 Will Apache SOAP support JAX-RPC

InstallationThis section helps resolve questions which arise when installing ApacheSOAP in a particular application server environment31 What jar files do I need to provide for Apache-SOAP clients32 How do I install Apache-SOAP on Tomcat 3x33 Can I install Apache-SOAP 21 on Tomcat 4034 How do I install Apache-SOAP on Bea WebLogic 5135 How do I install Apache-SOAP on Bea WebLogic 6036 How do I install Apache-SOAP on Bea WebLogic 61 beta37 How do I install Apache-SOAP on Resin38 How do I install Apache-SOAP on IBM WebSphere39 How do I install Apache-SOAP on Bluestone310 How do I install Apache-SOAP on Orion311 How do I install Apache-SOAP on Apache-JServ312 How do I install Apache-SOAP on iPlanet Web Server313 How do I install Apache-SOAP on iPlanet Application Server314 How do I install Apache-SOAP on Unifys ServletExec316 How do I install Apache-SOAP on Oracle 8i Application Server318 How do I install Apache-SOAP on Borland Application Server (BAS) 45

Troubleshooting This section answers general troubleshooting queries42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijob

The Apache SOAP Project Documentation

Page 15Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 6: The Apache SOAP Project Documentation

with QName that Was causing it to throw a NullPointerException if localPartconstructor arg was null Fixed a missing closing ltagt tag in listjsp Build now allowsdist target to build when ejb is not present Added support for config file element toallow users to enable or disable SOAP interface to Service Manager Changed allsamples to use the Fault classs toString() method instead of calling thegetFaultCode() and getFaultString() methods This will cause the samples to displayall the fault information and not just parts of it Added a new calculator demo thatsimulates a reverse polish notation calculator Fixed the EJB sample so that thecorrect parameters are passed to the EJB method Fixed up the interop sample andadded support for the echoMap service Updated to reflect Java 12+ requirementFixed some typos in the documentation Fixed WAS 35 instructions for using thecorrect Xerces JAR Updated deployment descriptor schema to reflect the mappingQName being made optional Made the XMLParserUtilsgetXMLDocBuilder()method synchronized Added support for turning off Nagles algorithm under TCP(HTTP) Fixed ArraySerializer to recognize null items when unmarshalling Changedunmarshalling of xsinull to be just as liberal as BooleanDeserializer is in what itaccepts

163 May 30 2001 - Version 22

Changed all code and samples to use JAXP no longer bound to Xerces Removedmany printlns from the server-side code replacing them with thrown Exceptions Asoapwar Web Application Archive is now included in the distribution for easierdeployment to Servlet containers Included SSL (on Tomcat) doc and linked to itfrom the Installation page Added support for serializingdeserializing javautilMapsAdded support for serializingdeserializing BigDecimal lt--gt xsddecimal Removednon-threadsafe private variables from Servlets If a service method with a matchingsignature is not found a second search is done for a method with an additional (first)parameter of type SOAPContext Users Guide has been re-worked and updatedCOM sample has been updated Added a BEA WebLogic EJB sample Changed theEJB providers so that it grabs the JNDIName from one of the options instead offrom the java class= section of the deployment descriptor For backwardscompatibility if it doesnt find it in the options section (using key=JNDIName) then itwill look in the old java class= section Added an XMLConfigManager Added aBaseConfigManager (to make authoring ConfigManagers easier) Added aworkaround to orgapachesoapFault to enable it to work with Xerces 131 andlater It will now accept a return value of from NodegetNamespaceURI() insteadof just accepting null or a non-empty String Fixed a bug when deserializing nulls oftype ur-type which are generated when the VectorSerializer finds nulls inside aVector Removed requirement of ltjavagt tag in deployment descriptor when usingpluggable providers Fixed a bug where a 400 error code was being returned insteadof the 500 required by SOAP Fixed a bug in header parsing code it was assumingthat a space existed after the character Unmarshalling logic now understands

The Apache SOAP Project Documentation

Page 6Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

1999 2000 and 2001 Schema simple types Unmarshalling logic can nowdeserialize payload with IDHREF attributes RPCRouter can now throw aSOAPException if the checkMustUnderstand property is set on theDeploymentDescriptor and a mustUnderstand=1 attribute is found on a headerThe output buffer size can now be explicitly set on the SOAPHTTPConnectionAdded HTTP proxy basic authentication support The SOAPHTTPConnection nowhas a maintainSession property which when true will cause theSOAPHTTPConnection to return the appropriate cookies with requests It is true bydefault Added a default encoding style property to SOAPMappingRegistry to beused when no encoding style is specified Removed special treatment of CDATAsections in the code that inserts escape sequences The code will now round tripStrings correctly whether they contain CDATA sections or not All the simplenumeric types now use a serializer that does not run its content throughUtilscleanString(String) Cleaned up handling of servlet init-parameters inRPCRouterServlet and MessageRouterServlet Removed transport hook systemproperty dependency The only remaining call to SystemgetProperty(String) is to getlineseparator This should help with some of the security constraints for Appletsand the like Removed some extraneous methods fromorgapachesoaputilStringUtils Put 2 lines back into XMISerializer andXMIDeserializer (the same 1 line in each actually) to enable them to work with thexmisoapjar which is posted on the site These lines were originally there but wereremoved to try to work with the latestXMI version For now the code works with theposted version Added the BidBuy interoperability sample MadeDateSerializerunmarshall() a little more lenient so that it handles parsing dateswith and without milliseconds specified Added a Troubleshooting table and a link toit from the front page Added an Interoperability section to the Users Guide Added aMigration section to the Users Guide Fixed a bug in StatelessEJBProvider andStatefulEJBProvider where the respEncStyle was being set but not used InRPCRouterServletdoGet() and MessageRouterServletdoGet() movedressetContentType() call before resgetWriter() call to be in compliance withServlet spec Added install docs for iPlanet

164 February 5 2001 - Version 21

Added Message Handling Support Added configurable error handling mechanismAdded pluggable provider support Added client-side HTTPS support Added HTTPproxy support Added HTTP basic authentication support Added support for SOAPMessages with Attachments Introduced SOAPContext Added support for transporthooks Added SSL support Reduced dependency on xsitype for deserializationAdded soap configuration file Added pluggable configuration manager Addedsupport for international character sets Added support for defaultserializationdeserialization of Hashtable (as xmlsoapMap) Date (asxsdtimeInstant) GregorianCalendar (as xsddate)

The Apache SOAP Project Documentation

Page 7Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

165 August 18 2000 - Version 20

Deprecated the rpcrouterjsp in favor of an RPCRouter servlet Steven J McDowallNoor Zaman Sanjiva Weerawarana Switched the stockquote demos provider fromwwwi3solutionscom to wwwxmltodaycom Sam Ruby Restructureddocumentation Sanjiva Weerawarana The serializer for javalangString now runs itscontent through UtilscleanString() to escape necessary characters Matthew JDuftler Added a distribution containing the source Matthew J Duftler Created a newsoap webapp Provides access to the web-based admin client and the rpcrouterservlet Sanjiva Weerawarana Changed remaining IBM-SOAP references toApache-SOAP Wouter Cloetens Mike Paolini Matthew J Duftler Added a serializerfor Vectors and Enumerations Glen Daniels Removed trailing in XSD and XSInamespace URIs Steven J McDowall The unmarshalling logic in Fault will nowaccept the SOAP-ENV namespace URI in addition to the old accepted behavior ofno namespace URI at all when processing subelements of Fault Steven JMcDowall Matthew J Duftler HTTPUtilspost() will now use port 80 if no port isspecified Steven J McDowall Fixed a bug that occurred when aServiceManagerClient was instantiated and used to make several invocations Theproblem was when there were no params the params property of the Call objectwas not being set to null Peter Brittenham Matthew J Duftler AddedgetAttributeNS() to DOMUtils It has similar behavior to DOMUtilsgetAttribute()DOMUtilsgetAttributeNS() will return null if there is no specified or default attributevalue Matthew J Duftler Fixed HTTP code to use rn instead of println for lineendings Kevin J Mitchell An array of bytes (ie byte[]) will now be serialized into aSOAP-ENCbase64 type A SOAP-ENCbase64 type will also now be deserializedinto a byte array (ie byte[]) Matthew J Duftler Sanjiva Weerawarana Removedextraneous references to BML namespace URI from deployjsp SanjivaWeerawarana

166 June 4 2000 - Version 12

Created initial code base from IBM-SOAP

2 FAQ

21 Apache SOAP Frequently Asked Questions (FAQ)

211 Apache SOAP Frequently Asked Questions (FAQ)

I have composed this list of questions partly from my own learning process and partly by

The Apache SOAP Project Documentation

Page 8Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

perusing questions from the SOAP User mailing list Corrections and suggestions for newquestions are always welcome Please forward new questions - preferably with answers - orerrors to the SOAP Developer mailing list

See also

bull Messaging The transport part of the XML puzzle by Gordon Van Huizenbull XML Protocol Comparisons produced by the W3Cbull Also see the SOAP FAQ maintained by Developmentorbull A Quick-Start Guide for Installing Apache SOAP by XMethodsbull Jonathan Chawkes SOAP FAQ which will eventually be merged with this FAQ and

hosted on the Apache SOAP web-sitebull SOAP and SMTP FAQ by Jonathan Chawkebull Apache SOAP and WebLogic 61Beta by Steve Livingstonbull Some info on RPC response encoding styles by Matthew J Duftler and Dirck Hecking

Namespaces

bull What are all these SOAP Namespaces

SOAP uses a few different namespaces for different elements and attributes depending onthe role that the data item in question plays in the message formatting handling andorencoding Looking at the Envelope element of a typical SOAP message we see thefollowing namespace declarations

1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchema

where 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) isthe XML Schema Instance namespace and 4) is the XML Schema Definition namespaceSOAP defines the first two namespaces and refers to the second two These namespacesreflect how all data type definitions in SOAP are delegated to XML Schema

The SOAP Envelope namespace defines the Envelope Header and Body elementnames and the encodingStyle actor and mustUnderstand attributes

The SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommendedfor any linear list of objects Ie Java 2 Collection objects can and probably should usethis encoding approach

The XML Schema Instance namespace defines the type attribute which identifies thedata type of an element

The Apache SOAP Project Documentation

Page 9Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

The XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

bull Do I need to use namespaces on my XML data

The short answer is yes but only a little

The long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements thoseelement names will have to be namespace qualified

Although it is technically possible to just use one of the SOAP namespaces it probablyisnt a good idea unless the element name is actually defined in that namespace (iedefined by the SOAP specification)

If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URIwhen you register an element name See Serialization below

bull What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

The Apache SOAP library will generate namespace prefixes as needed to make sure thatall necessary namespaces are declared If the same namespace gets declared twice withtwo different prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local partof the element name (the part after the prefix)

ltSOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacegt ltns3GetData xmlnsns3=urnacmecorpcomnamespacegtltns3GetDatagt

In this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

Serialization

bull How do I send user defined java objects using SOAP

You need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)

Although not required by the SOAP specification the Apache library requires that allXML Elements be namespace qualified via the QName utility class You can use (almost)

The Apache SOAP Project Documentation

Page 10Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

anything for the QName You might think of the first piece as a path and the secondpiece as a SOAP object You might want to use something like the following

SOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENC newQName(urnmyowncomobjects MyObject) ObjectclassmyObjSer myObjSer )

Then when you deploy the service that you are calling you must have a mapping entrythat looks something like the following

ltisdmapencodingStyle=httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializergt

On the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server touse the bean serializer to translate it into a urnmyowncomobjectsMyObject SOAPobject and send it to the client

One the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like touse the serializer called myObjSer to translate the SOAP object into a Java MyObjectobject

The main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use inyour QName object

Note that it is often not necessary to write your own Serializer or Deserializer If yourclass has a get and a set for each attribute that needs to be marshalled you can just usethe Apache SOAP BeanSerializer class

bull What are the different SOAP encoding styles Which should I use

The Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserialzier for anXML element

The SOAP specification allows the encodingStyle attribute to hold multiple URIswhich denote increasingly general encoding rules What isnt defined however is how a

The Apache SOAP Project Documentation

Page 11Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP processor is to determine which encoding style to apply Consequently theApache SOAP library does not support this syntax and will always treat theencodingStyle attribute value as a single URI reference

1 SOAP Encoding

This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully insection 5 of the SOAP specification

2 XMI Encoding3 Literal XML Encoding

bull How do you serialize javautilDate objects

Use BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializeris planned that serializes using the ISO date format

Date objects should be converted to xsddate or xsdtimeInstant to be SOAPcompliant The SOAP spec says For simple types SOAP adopts all the types found inthe section Built-in datatypes of the XML Schema Part 2 Datatypes but not all havebeen implemented

bull How do you return a DOM Element from an RPC Call

The encoding style of a Call return is determined by the encoding style of the RequestDOM Elements use Literal XML encoding For example if a service accepts one StringParameter and returns an Element just set the encoding style for the call tohttpxmlapacheorgxml-soapliteralxml and the encoding style for the parameter tohttpschemasxmlsoaporgsoapencoding Thus part of your client code would looklike Call call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML ) String strparam = joebobVector params = new Vector() paramsaddElement( newParameter( strparam Stringclass strparamConstantsNS_URI_SOAP_ENC ) )

Service Handlers

bull What is an actor

Every SOAP message has primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipient

SOAP allows Header entries to be addressed to specific actors with the

The Apache SOAP Project Documentation

Page 12Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP-ENVactor attribute This attribute contains the URI that uniquely identifies theactor

bull What tools are available that use Apache SOAP

Brought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format thatdescribe SOAP services There is an IBM alphaWorks toolkit that generates Java serviceclient libraries and service handler skeletons from a WSDL document See the WSDLspecification and the IBM toolkit

bull How do I get the samples installed

For Tomcat put the soapjar and samples classes on the system classpath (ie in$TOMCAT_HOMEclasseslib) rather than in webappssoapWEB-INF

bull I am having problems configuring SOAP with Webspere

Apache SOAP has worked under every version of WebSphere from 11 to 302 It willhowever work out of the box on WebSphere 35 with fixpak 2 applied The WebSphereinstall instructions for that level are part of the current SOAP kit You can browse themonline Be sure to check the following items

1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even ifit is default(80) just mention it in the URL ashttpaaabbbcccdddportsoapservletrpcrouter

2 Verify that xerces is at the start of your path not only by setting it in the App but alsoin the websphere configuration files (adminconfig setupclientbat)

bull Does Apache SOAP work with Microsoft SOAP

Yes but you need to install a patch to the MS SOAP package One of the well-knowninteroperability problems between Apache 20 and MS Soap is that MS clients do notsend type information with each parameter and the Apache soap server will reject suchrequests

James Snell has provided a patch adding the typing It can be found at SOAP-WRC website

22 Apache-SOAP Users FAQ

221 Apache-SOAP Users FAQ

This FAQ is based on the questions and answers that appear on the Apache-SOAP UsersMailing ListIt is currently maintained by Jonathan Chawke and was last modified on Sat 15-Mar-20031227 GMT

The Apache SOAP Project Documentation

Page 13Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Corrections and suggestions for new questions are always welcome

Table of Contents Hot Topics This section answers questions that have beenappearing frequently on the mailing list11 Help Im getting this error Element must contain afaultcode element12 Help Im getting this error Unable to resolve namespace URI for xsd13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP service14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not found15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodError16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAP19 How can I view the raw XML data that is exchanged between a SOAP client andserver110 I cant get SOAP working with Tomcat 4 (Catalina) Help

General This section answers general questions21 Where can I get help on SOAP issue XYZ22 Where can I find mailing list archives for the soap-user mailing list23 Im just getting started with SOAP Where can I find a tutorial on SOAP programming24 Are there any other SOAP FAQs available25 Where can I download the SOAP specification document(s)26 Are there any good books on SOAP27 What other SOAP implementations are available28 What is meant by the phrase SOAP is a wire-level protocol29 How does SOAP compare with other XML protocols210 How do I use TcpTunnel and TcpTunnelGUI211 How do I use SOAP over SSL212 How do I use SOAP over SMTP213 What products are available that will let me use ASP or Perl as SOAP client214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could use215 Where do I find nightly builds of the POP3 and SMTP beans218 Is there a way to generate SOAP stubskeleton code from a deployment descriptor219 Is there a way to generate SOAP deployment descriptor from IDL

The Apache SOAP Project Documentation

Page 14Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

220 Is there any way of specifying a timeout for a SOAP method invocation222 Are there any ISPs that will host SOAP applications224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh start228 How do I tell my Apache SOAP client to use a proxy server229 How do I perform Proxy Authentication with my Apache SOAP client230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy server231 Are there any commercially ready servlet containers which will support Apache SOAPclients 232 Where can I find a list of public SOAP services that are available on the Internet234 What tools are available that use Apache SOAP236 How do I restrict access to the Apache SOAP administration client238 How can I get the IP address of a client that is using my SOAP Service240 Can a client programmatically deploy a SOAP service241 Id like to deploy multiple services using a single deployment descriptor file Is thispossible242 Will Apache SOAP support JAXM when its ready243 Will Apache SOAP support JAX-RPC

InstallationThis section helps resolve questions which arise when installing ApacheSOAP in a particular application server environment31 What jar files do I need to provide for Apache-SOAP clients32 How do I install Apache-SOAP on Tomcat 3x33 Can I install Apache-SOAP 21 on Tomcat 4034 How do I install Apache-SOAP on Bea WebLogic 5135 How do I install Apache-SOAP on Bea WebLogic 6036 How do I install Apache-SOAP on Bea WebLogic 61 beta37 How do I install Apache-SOAP on Resin38 How do I install Apache-SOAP on IBM WebSphere39 How do I install Apache-SOAP on Bluestone310 How do I install Apache-SOAP on Orion311 How do I install Apache-SOAP on Apache-JServ312 How do I install Apache-SOAP on iPlanet Web Server313 How do I install Apache-SOAP on iPlanet Application Server314 How do I install Apache-SOAP on Unifys ServletExec316 How do I install Apache-SOAP on Oracle 8i Application Server318 How do I install Apache-SOAP on Borland Application Server (BAS) 45

Troubleshooting This section answers general troubleshooting queries42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijob

The Apache SOAP Project Documentation

Page 15Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 7: The Apache SOAP Project Documentation

1999 2000 and 2001 Schema simple types Unmarshalling logic can nowdeserialize payload with IDHREF attributes RPCRouter can now throw aSOAPException if the checkMustUnderstand property is set on theDeploymentDescriptor and a mustUnderstand=1 attribute is found on a headerThe output buffer size can now be explicitly set on the SOAPHTTPConnectionAdded HTTP proxy basic authentication support The SOAPHTTPConnection nowhas a maintainSession property which when true will cause theSOAPHTTPConnection to return the appropriate cookies with requests It is true bydefault Added a default encoding style property to SOAPMappingRegistry to beused when no encoding style is specified Removed special treatment of CDATAsections in the code that inserts escape sequences The code will now round tripStrings correctly whether they contain CDATA sections or not All the simplenumeric types now use a serializer that does not run its content throughUtilscleanString(String) Cleaned up handling of servlet init-parameters inRPCRouterServlet and MessageRouterServlet Removed transport hook systemproperty dependency The only remaining call to SystemgetProperty(String) is to getlineseparator This should help with some of the security constraints for Appletsand the like Removed some extraneous methods fromorgapachesoaputilStringUtils Put 2 lines back into XMISerializer andXMIDeserializer (the same 1 line in each actually) to enable them to work with thexmisoapjar which is posted on the site These lines were originally there but wereremoved to try to work with the latestXMI version For now the code works with theposted version Added the BidBuy interoperability sample MadeDateSerializerunmarshall() a little more lenient so that it handles parsing dateswith and without milliseconds specified Added a Troubleshooting table and a link toit from the front page Added an Interoperability section to the Users Guide Added aMigration section to the Users Guide Fixed a bug in StatelessEJBProvider andStatefulEJBProvider where the respEncStyle was being set but not used InRPCRouterServletdoGet() and MessageRouterServletdoGet() movedressetContentType() call before resgetWriter() call to be in compliance withServlet spec Added install docs for iPlanet

164 February 5 2001 - Version 21

Added Message Handling Support Added configurable error handling mechanismAdded pluggable provider support Added client-side HTTPS support Added HTTPproxy support Added HTTP basic authentication support Added support for SOAPMessages with Attachments Introduced SOAPContext Added support for transporthooks Added SSL support Reduced dependency on xsitype for deserializationAdded soap configuration file Added pluggable configuration manager Addedsupport for international character sets Added support for defaultserializationdeserialization of Hashtable (as xmlsoapMap) Date (asxsdtimeInstant) GregorianCalendar (as xsddate)

The Apache SOAP Project Documentation

Page 7Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

165 August 18 2000 - Version 20

Deprecated the rpcrouterjsp in favor of an RPCRouter servlet Steven J McDowallNoor Zaman Sanjiva Weerawarana Switched the stockquote demos provider fromwwwi3solutionscom to wwwxmltodaycom Sam Ruby Restructureddocumentation Sanjiva Weerawarana The serializer for javalangString now runs itscontent through UtilscleanString() to escape necessary characters Matthew JDuftler Added a distribution containing the source Matthew J Duftler Created a newsoap webapp Provides access to the web-based admin client and the rpcrouterservlet Sanjiva Weerawarana Changed remaining IBM-SOAP references toApache-SOAP Wouter Cloetens Mike Paolini Matthew J Duftler Added a serializerfor Vectors and Enumerations Glen Daniels Removed trailing in XSD and XSInamespace URIs Steven J McDowall The unmarshalling logic in Fault will nowaccept the SOAP-ENV namespace URI in addition to the old accepted behavior ofno namespace URI at all when processing subelements of Fault Steven JMcDowall Matthew J Duftler HTTPUtilspost() will now use port 80 if no port isspecified Steven J McDowall Fixed a bug that occurred when aServiceManagerClient was instantiated and used to make several invocations Theproblem was when there were no params the params property of the Call objectwas not being set to null Peter Brittenham Matthew J Duftler AddedgetAttributeNS() to DOMUtils It has similar behavior to DOMUtilsgetAttribute()DOMUtilsgetAttributeNS() will return null if there is no specified or default attributevalue Matthew J Duftler Fixed HTTP code to use rn instead of println for lineendings Kevin J Mitchell An array of bytes (ie byte[]) will now be serialized into aSOAP-ENCbase64 type A SOAP-ENCbase64 type will also now be deserializedinto a byte array (ie byte[]) Matthew J Duftler Sanjiva Weerawarana Removedextraneous references to BML namespace URI from deployjsp SanjivaWeerawarana

166 June 4 2000 - Version 12

Created initial code base from IBM-SOAP

2 FAQ

21 Apache SOAP Frequently Asked Questions (FAQ)

211 Apache SOAP Frequently Asked Questions (FAQ)

I have composed this list of questions partly from my own learning process and partly by

The Apache SOAP Project Documentation

Page 8Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

perusing questions from the SOAP User mailing list Corrections and suggestions for newquestions are always welcome Please forward new questions - preferably with answers - orerrors to the SOAP Developer mailing list

See also

bull Messaging The transport part of the XML puzzle by Gordon Van Huizenbull XML Protocol Comparisons produced by the W3Cbull Also see the SOAP FAQ maintained by Developmentorbull A Quick-Start Guide for Installing Apache SOAP by XMethodsbull Jonathan Chawkes SOAP FAQ which will eventually be merged with this FAQ and

hosted on the Apache SOAP web-sitebull SOAP and SMTP FAQ by Jonathan Chawkebull Apache SOAP and WebLogic 61Beta by Steve Livingstonbull Some info on RPC response encoding styles by Matthew J Duftler and Dirck Hecking

Namespaces

bull What are all these SOAP Namespaces

SOAP uses a few different namespaces for different elements and attributes depending onthe role that the data item in question plays in the message formatting handling andorencoding Looking at the Envelope element of a typical SOAP message we see thefollowing namespace declarations

1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchema

where 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) isthe XML Schema Instance namespace and 4) is the XML Schema Definition namespaceSOAP defines the first two namespaces and refers to the second two These namespacesreflect how all data type definitions in SOAP are delegated to XML Schema

The SOAP Envelope namespace defines the Envelope Header and Body elementnames and the encodingStyle actor and mustUnderstand attributes

The SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommendedfor any linear list of objects Ie Java 2 Collection objects can and probably should usethis encoding approach

The XML Schema Instance namespace defines the type attribute which identifies thedata type of an element

The Apache SOAP Project Documentation

Page 9Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

The XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

bull Do I need to use namespaces on my XML data

The short answer is yes but only a little

The long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements thoseelement names will have to be namespace qualified

Although it is technically possible to just use one of the SOAP namespaces it probablyisnt a good idea unless the element name is actually defined in that namespace (iedefined by the SOAP specification)

If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URIwhen you register an element name See Serialization below

bull What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

The Apache SOAP library will generate namespace prefixes as needed to make sure thatall necessary namespaces are declared If the same namespace gets declared twice withtwo different prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local partof the element name (the part after the prefix)

ltSOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacegt ltns3GetData xmlnsns3=urnacmecorpcomnamespacegtltns3GetDatagt

In this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

Serialization

bull How do I send user defined java objects using SOAP

You need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)

Although not required by the SOAP specification the Apache library requires that allXML Elements be namespace qualified via the QName utility class You can use (almost)

The Apache SOAP Project Documentation

Page 10Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

anything for the QName You might think of the first piece as a path and the secondpiece as a SOAP object You might want to use something like the following

SOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENC newQName(urnmyowncomobjects MyObject) ObjectclassmyObjSer myObjSer )

Then when you deploy the service that you are calling you must have a mapping entrythat looks something like the following

ltisdmapencodingStyle=httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializergt

On the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server touse the bean serializer to translate it into a urnmyowncomobjectsMyObject SOAPobject and send it to the client

One the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like touse the serializer called myObjSer to translate the SOAP object into a Java MyObjectobject

The main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use inyour QName object

Note that it is often not necessary to write your own Serializer or Deserializer If yourclass has a get and a set for each attribute that needs to be marshalled you can just usethe Apache SOAP BeanSerializer class

bull What are the different SOAP encoding styles Which should I use

The Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserialzier for anXML element

The SOAP specification allows the encodingStyle attribute to hold multiple URIswhich denote increasingly general encoding rules What isnt defined however is how a

The Apache SOAP Project Documentation

Page 11Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP processor is to determine which encoding style to apply Consequently theApache SOAP library does not support this syntax and will always treat theencodingStyle attribute value as a single URI reference

1 SOAP Encoding

This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully insection 5 of the SOAP specification

2 XMI Encoding3 Literal XML Encoding

bull How do you serialize javautilDate objects

Use BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializeris planned that serializes using the ISO date format

Date objects should be converted to xsddate or xsdtimeInstant to be SOAPcompliant The SOAP spec says For simple types SOAP adopts all the types found inthe section Built-in datatypes of the XML Schema Part 2 Datatypes but not all havebeen implemented

bull How do you return a DOM Element from an RPC Call

The encoding style of a Call return is determined by the encoding style of the RequestDOM Elements use Literal XML encoding For example if a service accepts one StringParameter and returns an Element just set the encoding style for the call tohttpxmlapacheorgxml-soapliteralxml and the encoding style for the parameter tohttpschemasxmlsoaporgsoapencoding Thus part of your client code would looklike Call call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML ) String strparam = joebobVector params = new Vector() paramsaddElement( newParameter( strparam Stringclass strparamConstantsNS_URI_SOAP_ENC ) )

Service Handlers

bull What is an actor

Every SOAP message has primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipient

SOAP allows Header entries to be addressed to specific actors with the

The Apache SOAP Project Documentation

Page 12Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP-ENVactor attribute This attribute contains the URI that uniquely identifies theactor

bull What tools are available that use Apache SOAP

Brought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format thatdescribe SOAP services There is an IBM alphaWorks toolkit that generates Java serviceclient libraries and service handler skeletons from a WSDL document See the WSDLspecification and the IBM toolkit

bull How do I get the samples installed

For Tomcat put the soapjar and samples classes on the system classpath (ie in$TOMCAT_HOMEclasseslib) rather than in webappssoapWEB-INF

bull I am having problems configuring SOAP with Webspere

Apache SOAP has worked under every version of WebSphere from 11 to 302 It willhowever work out of the box on WebSphere 35 with fixpak 2 applied The WebSphereinstall instructions for that level are part of the current SOAP kit You can browse themonline Be sure to check the following items

1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even ifit is default(80) just mention it in the URL ashttpaaabbbcccdddportsoapservletrpcrouter

2 Verify that xerces is at the start of your path not only by setting it in the App but alsoin the websphere configuration files (adminconfig setupclientbat)

bull Does Apache SOAP work with Microsoft SOAP

Yes but you need to install a patch to the MS SOAP package One of the well-knowninteroperability problems between Apache 20 and MS Soap is that MS clients do notsend type information with each parameter and the Apache soap server will reject suchrequests

James Snell has provided a patch adding the typing It can be found at SOAP-WRC website

22 Apache-SOAP Users FAQ

221 Apache-SOAP Users FAQ

This FAQ is based on the questions and answers that appear on the Apache-SOAP UsersMailing ListIt is currently maintained by Jonathan Chawke and was last modified on Sat 15-Mar-20031227 GMT

The Apache SOAP Project Documentation

Page 13Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Corrections and suggestions for new questions are always welcome

Table of Contents Hot Topics This section answers questions that have beenappearing frequently on the mailing list11 Help Im getting this error Element must contain afaultcode element12 Help Im getting this error Unable to resolve namespace URI for xsd13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP service14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not found15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodError16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAP19 How can I view the raw XML data that is exchanged between a SOAP client andserver110 I cant get SOAP working with Tomcat 4 (Catalina) Help

General This section answers general questions21 Where can I get help on SOAP issue XYZ22 Where can I find mailing list archives for the soap-user mailing list23 Im just getting started with SOAP Where can I find a tutorial on SOAP programming24 Are there any other SOAP FAQs available25 Where can I download the SOAP specification document(s)26 Are there any good books on SOAP27 What other SOAP implementations are available28 What is meant by the phrase SOAP is a wire-level protocol29 How does SOAP compare with other XML protocols210 How do I use TcpTunnel and TcpTunnelGUI211 How do I use SOAP over SSL212 How do I use SOAP over SMTP213 What products are available that will let me use ASP or Perl as SOAP client214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could use215 Where do I find nightly builds of the POP3 and SMTP beans218 Is there a way to generate SOAP stubskeleton code from a deployment descriptor219 Is there a way to generate SOAP deployment descriptor from IDL

The Apache SOAP Project Documentation

Page 14Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

220 Is there any way of specifying a timeout for a SOAP method invocation222 Are there any ISPs that will host SOAP applications224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh start228 How do I tell my Apache SOAP client to use a proxy server229 How do I perform Proxy Authentication with my Apache SOAP client230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy server231 Are there any commercially ready servlet containers which will support Apache SOAPclients 232 Where can I find a list of public SOAP services that are available on the Internet234 What tools are available that use Apache SOAP236 How do I restrict access to the Apache SOAP administration client238 How can I get the IP address of a client that is using my SOAP Service240 Can a client programmatically deploy a SOAP service241 Id like to deploy multiple services using a single deployment descriptor file Is thispossible242 Will Apache SOAP support JAXM when its ready243 Will Apache SOAP support JAX-RPC

InstallationThis section helps resolve questions which arise when installing ApacheSOAP in a particular application server environment31 What jar files do I need to provide for Apache-SOAP clients32 How do I install Apache-SOAP on Tomcat 3x33 Can I install Apache-SOAP 21 on Tomcat 4034 How do I install Apache-SOAP on Bea WebLogic 5135 How do I install Apache-SOAP on Bea WebLogic 6036 How do I install Apache-SOAP on Bea WebLogic 61 beta37 How do I install Apache-SOAP on Resin38 How do I install Apache-SOAP on IBM WebSphere39 How do I install Apache-SOAP on Bluestone310 How do I install Apache-SOAP on Orion311 How do I install Apache-SOAP on Apache-JServ312 How do I install Apache-SOAP on iPlanet Web Server313 How do I install Apache-SOAP on iPlanet Application Server314 How do I install Apache-SOAP on Unifys ServletExec316 How do I install Apache-SOAP on Oracle 8i Application Server318 How do I install Apache-SOAP on Borland Application Server (BAS) 45

Troubleshooting This section answers general troubleshooting queries42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijob

The Apache SOAP Project Documentation

Page 15Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 8: The Apache SOAP Project Documentation

165 August 18 2000 - Version 20

Deprecated the rpcrouterjsp in favor of an RPCRouter servlet Steven J McDowallNoor Zaman Sanjiva Weerawarana Switched the stockquote demos provider fromwwwi3solutionscom to wwwxmltodaycom Sam Ruby Restructureddocumentation Sanjiva Weerawarana The serializer for javalangString now runs itscontent through UtilscleanString() to escape necessary characters Matthew JDuftler Added a distribution containing the source Matthew J Duftler Created a newsoap webapp Provides access to the web-based admin client and the rpcrouterservlet Sanjiva Weerawarana Changed remaining IBM-SOAP references toApache-SOAP Wouter Cloetens Mike Paolini Matthew J Duftler Added a serializerfor Vectors and Enumerations Glen Daniels Removed trailing in XSD and XSInamespace URIs Steven J McDowall The unmarshalling logic in Fault will nowaccept the SOAP-ENV namespace URI in addition to the old accepted behavior ofno namespace URI at all when processing subelements of Fault Steven JMcDowall Matthew J Duftler HTTPUtilspost() will now use port 80 if no port isspecified Steven J McDowall Fixed a bug that occurred when aServiceManagerClient was instantiated and used to make several invocations Theproblem was when there were no params the params property of the Call objectwas not being set to null Peter Brittenham Matthew J Duftler AddedgetAttributeNS() to DOMUtils It has similar behavior to DOMUtilsgetAttribute()DOMUtilsgetAttributeNS() will return null if there is no specified or default attributevalue Matthew J Duftler Fixed HTTP code to use rn instead of println for lineendings Kevin J Mitchell An array of bytes (ie byte[]) will now be serialized into aSOAP-ENCbase64 type A SOAP-ENCbase64 type will also now be deserializedinto a byte array (ie byte[]) Matthew J Duftler Sanjiva Weerawarana Removedextraneous references to BML namespace URI from deployjsp SanjivaWeerawarana

166 June 4 2000 - Version 12

Created initial code base from IBM-SOAP

2 FAQ

21 Apache SOAP Frequently Asked Questions (FAQ)

211 Apache SOAP Frequently Asked Questions (FAQ)

I have composed this list of questions partly from my own learning process and partly by

The Apache SOAP Project Documentation

Page 8Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

perusing questions from the SOAP User mailing list Corrections and suggestions for newquestions are always welcome Please forward new questions - preferably with answers - orerrors to the SOAP Developer mailing list

See also

bull Messaging The transport part of the XML puzzle by Gordon Van Huizenbull XML Protocol Comparisons produced by the W3Cbull Also see the SOAP FAQ maintained by Developmentorbull A Quick-Start Guide for Installing Apache SOAP by XMethodsbull Jonathan Chawkes SOAP FAQ which will eventually be merged with this FAQ and

hosted on the Apache SOAP web-sitebull SOAP and SMTP FAQ by Jonathan Chawkebull Apache SOAP and WebLogic 61Beta by Steve Livingstonbull Some info on RPC response encoding styles by Matthew J Duftler and Dirck Hecking

Namespaces

bull What are all these SOAP Namespaces

SOAP uses a few different namespaces for different elements and attributes depending onthe role that the data item in question plays in the message formatting handling andorencoding Looking at the Envelope element of a typical SOAP message we see thefollowing namespace declarations

1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchema

where 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) isthe XML Schema Instance namespace and 4) is the XML Schema Definition namespaceSOAP defines the first two namespaces and refers to the second two These namespacesreflect how all data type definitions in SOAP are delegated to XML Schema

The SOAP Envelope namespace defines the Envelope Header and Body elementnames and the encodingStyle actor and mustUnderstand attributes

The SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommendedfor any linear list of objects Ie Java 2 Collection objects can and probably should usethis encoding approach

The XML Schema Instance namespace defines the type attribute which identifies thedata type of an element

The Apache SOAP Project Documentation

Page 9Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

The XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

bull Do I need to use namespaces on my XML data

The short answer is yes but only a little

The long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements thoseelement names will have to be namespace qualified

Although it is technically possible to just use one of the SOAP namespaces it probablyisnt a good idea unless the element name is actually defined in that namespace (iedefined by the SOAP specification)

If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URIwhen you register an element name See Serialization below

bull What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

The Apache SOAP library will generate namespace prefixes as needed to make sure thatall necessary namespaces are declared If the same namespace gets declared twice withtwo different prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local partof the element name (the part after the prefix)

ltSOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacegt ltns3GetData xmlnsns3=urnacmecorpcomnamespacegtltns3GetDatagt

In this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

Serialization

bull How do I send user defined java objects using SOAP

You need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)

Although not required by the SOAP specification the Apache library requires that allXML Elements be namespace qualified via the QName utility class You can use (almost)

The Apache SOAP Project Documentation

Page 10Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

anything for the QName You might think of the first piece as a path and the secondpiece as a SOAP object You might want to use something like the following

SOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENC newQName(urnmyowncomobjects MyObject) ObjectclassmyObjSer myObjSer )

Then when you deploy the service that you are calling you must have a mapping entrythat looks something like the following

ltisdmapencodingStyle=httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializergt

On the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server touse the bean serializer to translate it into a urnmyowncomobjectsMyObject SOAPobject and send it to the client

One the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like touse the serializer called myObjSer to translate the SOAP object into a Java MyObjectobject

The main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use inyour QName object

Note that it is often not necessary to write your own Serializer or Deserializer If yourclass has a get and a set for each attribute that needs to be marshalled you can just usethe Apache SOAP BeanSerializer class

bull What are the different SOAP encoding styles Which should I use

The Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserialzier for anXML element

The SOAP specification allows the encodingStyle attribute to hold multiple URIswhich denote increasingly general encoding rules What isnt defined however is how a

The Apache SOAP Project Documentation

Page 11Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP processor is to determine which encoding style to apply Consequently theApache SOAP library does not support this syntax and will always treat theencodingStyle attribute value as a single URI reference

1 SOAP Encoding

This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully insection 5 of the SOAP specification

2 XMI Encoding3 Literal XML Encoding

bull How do you serialize javautilDate objects

Use BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializeris planned that serializes using the ISO date format

Date objects should be converted to xsddate or xsdtimeInstant to be SOAPcompliant The SOAP spec says For simple types SOAP adopts all the types found inthe section Built-in datatypes of the XML Schema Part 2 Datatypes but not all havebeen implemented

bull How do you return a DOM Element from an RPC Call

The encoding style of a Call return is determined by the encoding style of the RequestDOM Elements use Literal XML encoding For example if a service accepts one StringParameter and returns an Element just set the encoding style for the call tohttpxmlapacheorgxml-soapliteralxml and the encoding style for the parameter tohttpschemasxmlsoaporgsoapencoding Thus part of your client code would looklike Call call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML ) String strparam = joebobVector params = new Vector() paramsaddElement( newParameter( strparam Stringclass strparamConstantsNS_URI_SOAP_ENC ) )

Service Handlers

bull What is an actor

Every SOAP message has primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipient

SOAP allows Header entries to be addressed to specific actors with the

The Apache SOAP Project Documentation

Page 12Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP-ENVactor attribute This attribute contains the URI that uniquely identifies theactor

bull What tools are available that use Apache SOAP

Brought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format thatdescribe SOAP services There is an IBM alphaWorks toolkit that generates Java serviceclient libraries and service handler skeletons from a WSDL document See the WSDLspecification and the IBM toolkit

bull How do I get the samples installed

For Tomcat put the soapjar and samples classes on the system classpath (ie in$TOMCAT_HOMEclasseslib) rather than in webappssoapWEB-INF

bull I am having problems configuring SOAP with Webspere

Apache SOAP has worked under every version of WebSphere from 11 to 302 It willhowever work out of the box on WebSphere 35 with fixpak 2 applied The WebSphereinstall instructions for that level are part of the current SOAP kit You can browse themonline Be sure to check the following items

1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even ifit is default(80) just mention it in the URL ashttpaaabbbcccdddportsoapservletrpcrouter

2 Verify that xerces is at the start of your path not only by setting it in the App but alsoin the websphere configuration files (adminconfig setupclientbat)

bull Does Apache SOAP work with Microsoft SOAP

Yes but you need to install a patch to the MS SOAP package One of the well-knowninteroperability problems between Apache 20 and MS Soap is that MS clients do notsend type information with each parameter and the Apache soap server will reject suchrequests

James Snell has provided a patch adding the typing It can be found at SOAP-WRC website

22 Apache-SOAP Users FAQ

221 Apache-SOAP Users FAQ

This FAQ is based on the questions and answers that appear on the Apache-SOAP UsersMailing ListIt is currently maintained by Jonathan Chawke and was last modified on Sat 15-Mar-20031227 GMT

The Apache SOAP Project Documentation

Page 13Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Corrections and suggestions for new questions are always welcome

Table of Contents Hot Topics This section answers questions that have beenappearing frequently on the mailing list11 Help Im getting this error Element must contain afaultcode element12 Help Im getting this error Unable to resolve namespace URI for xsd13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP service14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not found15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodError16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAP19 How can I view the raw XML data that is exchanged between a SOAP client andserver110 I cant get SOAP working with Tomcat 4 (Catalina) Help

General This section answers general questions21 Where can I get help on SOAP issue XYZ22 Where can I find mailing list archives for the soap-user mailing list23 Im just getting started with SOAP Where can I find a tutorial on SOAP programming24 Are there any other SOAP FAQs available25 Where can I download the SOAP specification document(s)26 Are there any good books on SOAP27 What other SOAP implementations are available28 What is meant by the phrase SOAP is a wire-level protocol29 How does SOAP compare with other XML protocols210 How do I use TcpTunnel and TcpTunnelGUI211 How do I use SOAP over SSL212 How do I use SOAP over SMTP213 What products are available that will let me use ASP or Perl as SOAP client214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could use215 Where do I find nightly builds of the POP3 and SMTP beans218 Is there a way to generate SOAP stubskeleton code from a deployment descriptor219 Is there a way to generate SOAP deployment descriptor from IDL

The Apache SOAP Project Documentation

Page 14Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

220 Is there any way of specifying a timeout for a SOAP method invocation222 Are there any ISPs that will host SOAP applications224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh start228 How do I tell my Apache SOAP client to use a proxy server229 How do I perform Proxy Authentication with my Apache SOAP client230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy server231 Are there any commercially ready servlet containers which will support Apache SOAPclients 232 Where can I find a list of public SOAP services that are available on the Internet234 What tools are available that use Apache SOAP236 How do I restrict access to the Apache SOAP administration client238 How can I get the IP address of a client that is using my SOAP Service240 Can a client programmatically deploy a SOAP service241 Id like to deploy multiple services using a single deployment descriptor file Is thispossible242 Will Apache SOAP support JAXM when its ready243 Will Apache SOAP support JAX-RPC

InstallationThis section helps resolve questions which arise when installing ApacheSOAP in a particular application server environment31 What jar files do I need to provide for Apache-SOAP clients32 How do I install Apache-SOAP on Tomcat 3x33 Can I install Apache-SOAP 21 on Tomcat 4034 How do I install Apache-SOAP on Bea WebLogic 5135 How do I install Apache-SOAP on Bea WebLogic 6036 How do I install Apache-SOAP on Bea WebLogic 61 beta37 How do I install Apache-SOAP on Resin38 How do I install Apache-SOAP on IBM WebSphere39 How do I install Apache-SOAP on Bluestone310 How do I install Apache-SOAP on Orion311 How do I install Apache-SOAP on Apache-JServ312 How do I install Apache-SOAP on iPlanet Web Server313 How do I install Apache-SOAP on iPlanet Application Server314 How do I install Apache-SOAP on Unifys ServletExec316 How do I install Apache-SOAP on Oracle 8i Application Server318 How do I install Apache-SOAP on Borland Application Server (BAS) 45

Troubleshooting This section answers general troubleshooting queries42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijob

The Apache SOAP Project Documentation

Page 15Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 9: The Apache SOAP Project Documentation

perusing questions from the SOAP User mailing list Corrections and suggestions for newquestions are always welcome Please forward new questions - preferably with answers - orerrors to the SOAP Developer mailing list

See also

bull Messaging The transport part of the XML puzzle by Gordon Van Huizenbull XML Protocol Comparisons produced by the W3Cbull Also see the SOAP FAQ maintained by Developmentorbull A Quick-Start Guide for Installing Apache SOAP by XMethodsbull Jonathan Chawkes SOAP FAQ which will eventually be merged with this FAQ and

hosted on the Apache SOAP web-sitebull SOAP and SMTP FAQ by Jonathan Chawkebull Apache SOAP and WebLogic 61Beta by Steve Livingstonbull Some info on RPC response encoding styles by Matthew J Duftler and Dirck Hecking

Namespaces

bull What are all these SOAP Namespaces

SOAP uses a few different namespaces for different elements and attributes depending onthe role that the data item in question plays in the message formatting handling andorencoding Looking at the Envelope element of a typical SOAP message we see thefollowing namespace declarations

1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchema

where 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) isthe XML Schema Instance namespace and 4) is the XML Schema Definition namespaceSOAP defines the first two namespaces and refers to the second two These namespacesreflect how all data type definitions in SOAP are delegated to XML Schema

The SOAP Envelope namespace defines the Envelope Header and Body elementnames and the encodingStyle actor and mustUnderstand attributes

The SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommendedfor any linear list of objects Ie Java 2 Collection objects can and probably should usethis encoding approach

The XML Schema Instance namespace defines the type attribute which identifies thedata type of an element

The Apache SOAP Project Documentation

Page 9Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

The XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

bull Do I need to use namespaces on my XML data

The short answer is yes but only a little

The long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements thoseelement names will have to be namespace qualified

Although it is technically possible to just use one of the SOAP namespaces it probablyisnt a good idea unless the element name is actually defined in that namespace (iedefined by the SOAP specification)

If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URIwhen you register an element name See Serialization below

bull What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

The Apache SOAP library will generate namespace prefixes as needed to make sure thatall necessary namespaces are declared If the same namespace gets declared twice withtwo different prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local partof the element name (the part after the prefix)

ltSOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacegt ltns3GetData xmlnsns3=urnacmecorpcomnamespacegtltns3GetDatagt

In this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

Serialization

bull How do I send user defined java objects using SOAP

You need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)

Although not required by the SOAP specification the Apache library requires that allXML Elements be namespace qualified via the QName utility class You can use (almost)

The Apache SOAP Project Documentation

Page 10Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

anything for the QName You might think of the first piece as a path and the secondpiece as a SOAP object You might want to use something like the following

SOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENC newQName(urnmyowncomobjects MyObject) ObjectclassmyObjSer myObjSer )

Then when you deploy the service that you are calling you must have a mapping entrythat looks something like the following

ltisdmapencodingStyle=httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializergt

On the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server touse the bean serializer to translate it into a urnmyowncomobjectsMyObject SOAPobject and send it to the client

One the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like touse the serializer called myObjSer to translate the SOAP object into a Java MyObjectobject

The main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use inyour QName object

Note that it is often not necessary to write your own Serializer or Deserializer If yourclass has a get and a set for each attribute that needs to be marshalled you can just usethe Apache SOAP BeanSerializer class

bull What are the different SOAP encoding styles Which should I use

The Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserialzier for anXML element

The SOAP specification allows the encodingStyle attribute to hold multiple URIswhich denote increasingly general encoding rules What isnt defined however is how a

The Apache SOAP Project Documentation

Page 11Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP processor is to determine which encoding style to apply Consequently theApache SOAP library does not support this syntax and will always treat theencodingStyle attribute value as a single URI reference

1 SOAP Encoding

This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully insection 5 of the SOAP specification

2 XMI Encoding3 Literal XML Encoding

bull How do you serialize javautilDate objects

Use BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializeris planned that serializes using the ISO date format

Date objects should be converted to xsddate or xsdtimeInstant to be SOAPcompliant The SOAP spec says For simple types SOAP adopts all the types found inthe section Built-in datatypes of the XML Schema Part 2 Datatypes but not all havebeen implemented

bull How do you return a DOM Element from an RPC Call

The encoding style of a Call return is determined by the encoding style of the RequestDOM Elements use Literal XML encoding For example if a service accepts one StringParameter and returns an Element just set the encoding style for the call tohttpxmlapacheorgxml-soapliteralxml and the encoding style for the parameter tohttpschemasxmlsoaporgsoapencoding Thus part of your client code would looklike Call call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML ) String strparam = joebobVector params = new Vector() paramsaddElement( newParameter( strparam Stringclass strparamConstantsNS_URI_SOAP_ENC ) )

Service Handlers

bull What is an actor

Every SOAP message has primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipient

SOAP allows Header entries to be addressed to specific actors with the

The Apache SOAP Project Documentation

Page 12Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP-ENVactor attribute This attribute contains the URI that uniquely identifies theactor

bull What tools are available that use Apache SOAP

Brought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format thatdescribe SOAP services There is an IBM alphaWorks toolkit that generates Java serviceclient libraries and service handler skeletons from a WSDL document See the WSDLspecification and the IBM toolkit

bull How do I get the samples installed

For Tomcat put the soapjar and samples classes on the system classpath (ie in$TOMCAT_HOMEclasseslib) rather than in webappssoapWEB-INF

bull I am having problems configuring SOAP with Webspere

Apache SOAP has worked under every version of WebSphere from 11 to 302 It willhowever work out of the box on WebSphere 35 with fixpak 2 applied The WebSphereinstall instructions for that level are part of the current SOAP kit You can browse themonline Be sure to check the following items

1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even ifit is default(80) just mention it in the URL ashttpaaabbbcccdddportsoapservletrpcrouter

2 Verify that xerces is at the start of your path not only by setting it in the App but alsoin the websphere configuration files (adminconfig setupclientbat)

bull Does Apache SOAP work with Microsoft SOAP

Yes but you need to install a patch to the MS SOAP package One of the well-knowninteroperability problems between Apache 20 and MS Soap is that MS clients do notsend type information with each parameter and the Apache soap server will reject suchrequests

James Snell has provided a patch adding the typing It can be found at SOAP-WRC website

22 Apache-SOAP Users FAQ

221 Apache-SOAP Users FAQ

This FAQ is based on the questions and answers that appear on the Apache-SOAP UsersMailing ListIt is currently maintained by Jonathan Chawke and was last modified on Sat 15-Mar-20031227 GMT

The Apache SOAP Project Documentation

Page 13Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Corrections and suggestions for new questions are always welcome

Table of Contents Hot Topics This section answers questions that have beenappearing frequently on the mailing list11 Help Im getting this error Element must contain afaultcode element12 Help Im getting this error Unable to resolve namespace URI for xsd13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP service14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not found15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodError16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAP19 How can I view the raw XML data that is exchanged between a SOAP client andserver110 I cant get SOAP working with Tomcat 4 (Catalina) Help

General This section answers general questions21 Where can I get help on SOAP issue XYZ22 Where can I find mailing list archives for the soap-user mailing list23 Im just getting started with SOAP Where can I find a tutorial on SOAP programming24 Are there any other SOAP FAQs available25 Where can I download the SOAP specification document(s)26 Are there any good books on SOAP27 What other SOAP implementations are available28 What is meant by the phrase SOAP is a wire-level protocol29 How does SOAP compare with other XML protocols210 How do I use TcpTunnel and TcpTunnelGUI211 How do I use SOAP over SSL212 How do I use SOAP over SMTP213 What products are available that will let me use ASP or Perl as SOAP client214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could use215 Where do I find nightly builds of the POP3 and SMTP beans218 Is there a way to generate SOAP stubskeleton code from a deployment descriptor219 Is there a way to generate SOAP deployment descriptor from IDL

The Apache SOAP Project Documentation

Page 14Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

220 Is there any way of specifying a timeout for a SOAP method invocation222 Are there any ISPs that will host SOAP applications224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh start228 How do I tell my Apache SOAP client to use a proxy server229 How do I perform Proxy Authentication with my Apache SOAP client230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy server231 Are there any commercially ready servlet containers which will support Apache SOAPclients 232 Where can I find a list of public SOAP services that are available on the Internet234 What tools are available that use Apache SOAP236 How do I restrict access to the Apache SOAP administration client238 How can I get the IP address of a client that is using my SOAP Service240 Can a client programmatically deploy a SOAP service241 Id like to deploy multiple services using a single deployment descriptor file Is thispossible242 Will Apache SOAP support JAXM when its ready243 Will Apache SOAP support JAX-RPC

InstallationThis section helps resolve questions which arise when installing ApacheSOAP in a particular application server environment31 What jar files do I need to provide for Apache-SOAP clients32 How do I install Apache-SOAP on Tomcat 3x33 Can I install Apache-SOAP 21 on Tomcat 4034 How do I install Apache-SOAP on Bea WebLogic 5135 How do I install Apache-SOAP on Bea WebLogic 6036 How do I install Apache-SOAP on Bea WebLogic 61 beta37 How do I install Apache-SOAP on Resin38 How do I install Apache-SOAP on IBM WebSphere39 How do I install Apache-SOAP on Bluestone310 How do I install Apache-SOAP on Orion311 How do I install Apache-SOAP on Apache-JServ312 How do I install Apache-SOAP on iPlanet Web Server313 How do I install Apache-SOAP on iPlanet Application Server314 How do I install Apache-SOAP on Unifys ServletExec316 How do I install Apache-SOAP on Oracle 8i Application Server318 How do I install Apache-SOAP on Borland Application Server (BAS) 45

Troubleshooting This section answers general troubleshooting queries42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijob

The Apache SOAP Project Documentation

Page 15Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 10: The Apache SOAP Project Documentation

The XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

bull Do I need to use namespaces on my XML data

The short answer is yes but only a little

The long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements thoseelement names will have to be namespace qualified

Although it is technically possible to just use one of the SOAP namespaces it probablyisnt a good idea unless the element name is actually defined in that namespace (iedefined by the SOAP specification)

If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URIwhen you register an element name See Serialization below

bull What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

The Apache SOAP library will generate namespace prefixes as needed to make sure thatall necessary namespaces are declared If the same namespace gets declared twice withtwo different prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local partof the element name (the part after the prefix)

ltSOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacegt ltns3GetData xmlnsns3=urnacmecorpcomnamespacegtltns3GetDatagt

In this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

Serialization

bull How do I send user defined java objects using SOAP

You need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)

Although not required by the SOAP specification the Apache library requires that allXML Elements be namespace qualified via the QName utility class You can use (almost)

The Apache SOAP Project Documentation

Page 10Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

anything for the QName You might think of the first piece as a path and the secondpiece as a SOAP object You might want to use something like the following

SOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENC newQName(urnmyowncomobjects MyObject) ObjectclassmyObjSer myObjSer )

Then when you deploy the service that you are calling you must have a mapping entrythat looks something like the following

ltisdmapencodingStyle=httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializergt

On the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server touse the bean serializer to translate it into a urnmyowncomobjectsMyObject SOAPobject and send it to the client

One the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like touse the serializer called myObjSer to translate the SOAP object into a Java MyObjectobject

The main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use inyour QName object

Note that it is often not necessary to write your own Serializer or Deserializer If yourclass has a get and a set for each attribute that needs to be marshalled you can just usethe Apache SOAP BeanSerializer class

bull What are the different SOAP encoding styles Which should I use

The Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserialzier for anXML element

The SOAP specification allows the encodingStyle attribute to hold multiple URIswhich denote increasingly general encoding rules What isnt defined however is how a

The Apache SOAP Project Documentation

Page 11Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP processor is to determine which encoding style to apply Consequently theApache SOAP library does not support this syntax and will always treat theencodingStyle attribute value as a single URI reference

1 SOAP Encoding

This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully insection 5 of the SOAP specification

2 XMI Encoding3 Literal XML Encoding

bull How do you serialize javautilDate objects

Use BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializeris planned that serializes using the ISO date format

Date objects should be converted to xsddate or xsdtimeInstant to be SOAPcompliant The SOAP spec says For simple types SOAP adopts all the types found inthe section Built-in datatypes of the XML Schema Part 2 Datatypes but not all havebeen implemented

bull How do you return a DOM Element from an RPC Call

The encoding style of a Call return is determined by the encoding style of the RequestDOM Elements use Literal XML encoding For example if a service accepts one StringParameter and returns an Element just set the encoding style for the call tohttpxmlapacheorgxml-soapliteralxml and the encoding style for the parameter tohttpschemasxmlsoaporgsoapencoding Thus part of your client code would looklike Call call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML ) String strparam = joebobVector params = new Vector() paramsaddElement( newParameter( strparam Stringclass strparamConstantsNS_URI_SOAP_ENC ) )

Service Handlers

bull What is an actor

Every SOAP message has primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipient

SOAP allows Header entries to be addressed to specific actors with the

The Apache SOAP Project Documentation

Page 12Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP-ENVactor attribute This attribute contains the URI that uniquely identifies theactor

bull What tools are available that use Apache SOAP

Brought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format thatdescribe SOAP services There is an IBM alphaWorks toolkit that generates Java serviceclient libraries and service handler skeletons from a WSDL document See the WSDLspecification and the IBM toolkit

bull How do I get the samples installed

For Tomcat put the soapjar and samples classes on the system classpath (ie in$TOMCAT_HOMEclasseslib) rather than in webappssoapWEB-INF

bull I am having problems configuring SOAP with Webspere

Apache SOAP has worked under every version of WebSphere from 11 to 302 It willhowever work out of the box on WebSphere 35 with fixpak 2 applied The WebSphereinstall instructions for that level are part of the current SOAP kit You can browse themonline Be sure to check the following items

1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even ifit is default(80) just mention it in the URL ashttpaaabbbcccdddportsoapservletrpcrouter

2 Verify that xerces is at the start of your path not only by setting it in the App but alsoin the websphere configuration files (adminconfig setupclientbat)

bull Does Apache SOAP work with Microsoft SOAP

Yes but you need to install a patch to the MS SOAP package One of the well-knowninteroperability problems between Apache 20 and MS Soap is that MS clients do notsend type information with each parameter and the Apache soap server will reject suchrequests

James Snell has provided a patch adding the typing It can be found at SOAP-WRC website

22 Apache-SOAP Users FAQ

221 Apache-SOAP Users FAQ

This FAQ is based on the questions and answers that appear on the Apache-SOAP UsersMailing ListIt is currently maintained by Jonathan Chawke and was last modified on Sat 15-Mar-20031227 GMT

The Apache SOAP Project Documentation

Page 13Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Corrections and suggestions for new questions are always welcome

Table of Contents Hot Topics This section answers questions that have beenappearing frequently on the mailing list11 Help Im getting this error Element must contain afaultcode element12 Help Im getting this error Unable to resolve namespace URI for xsd13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP service14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not found15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodError16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAP19 How can I view the raw XML data that is exchanged between a SOAP client andserver110 I cant get SOAP working with Tomcat 4 (Catalina) Help

General This section answers general questions21 Where can I get help on SOAP issue XYZ22 Where can I find mailing list archives for the soap-user mailing list23 Im just getting started with SOAP Where can I find a tutorial on SOAP programming24 Are there any other SOAP FAQs available25 Where can I download the SOAP specification document(s)26 Are there any good books on SOAP27 What other SOAP implementations are available28 What is meant by the phrase SOAP is a wire-level protocol29 How does SOAP compare with other XML protocols210 How do I use TcpTunnel and TcpTunnelGUI211 How do I use SOAP over SSL212 How do I use SOAP over SMTP213 What products are available that will let me use ASP or Perl as SOAP client214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could use215 Where do I find nightly builds of the POP3 and SMTP beans218 Is there a way to generate SOAP stubskeleton code from a deployment descriptor219 Is there a way to generate SOAP deployment descriptor from IDL

The Apache SOAP Project Documentation

Page 14Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

220 Is there any way of specifying a timeout for a SOAP method invocation222 Are there any ISPs that will host SOAP applications224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh start228 How do I tell my Apache SOAP client to use a proxy server229 How do I perform Proxy Authentication with my Apache SOAP client230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy server231 Are there any commercially ready servlet containers which will support Apache SOAPclients 232 Where can I find a list of public SOAP services that are available on the Internet234 What tools are available that use Apache SOAP236 How do I restrict access to the Apache SOAP administration client238 How can I get the IP address of a client that is using my SOAP Service240 Can a client programmatically deploy a SOAP service241 Id like to deploy multiple services using a single deployment descriptor file Is thispossible242 Will Apache SOAP support JAXM when its ready243 Will Apache SOAP support JAX-RPC

InstallationThis section helps resolve questions which arise when installing ApacheSOAP in a particular application server environment31 What jar files do I need to provide for Apache-SOAP clients32 How do I install Apache-SOAP on Tomcat 3x33 Can I install Apache-SOAP 21 on Tomcat 4034 How do I install Apache-SOAP on Bea WebLogic 5135 How do I install Apache-SOAP on Bea WebLogic 6036 How do I install Apache-SOAP on Bea WebLogic 61 beta37 How do I install Apache-SOAP on Resin38 How do I install Apache-SOAP on IBM WebSphere39 How do I install Apache-SOAP on Bluestone310 How do I install Apache-SOAP on Orion311 How do I install Apache-SOAP on Apache-JServ312 How do I install Apache-SOAP on iPlanet Web Server313 How do I install Apache-SOAP on iPlanet Application Server314 How do I install Apache-SOAP on Unifys ServletExec316 How do I install Apache-SOAP on Oracle 8i Application Server318 How do I install Apache-SOAP on Borland Application Server (BAS) 45

Troubleshooting This section answers general troubleshooting queries42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijob

The Apache SOAP Project Documentation

Page 15Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 11: The Apache SOAP Project Documentation

anything for the QName You might think of the first piece as a path and the secondpiece as a SOAP object You might want to use something like the following

SOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENC newQName(urnmyowncomobjects MyObject) ObjectclassmyObjSer myObjSer )

Then when you deploy the service that you are calling you must have a mapping entrythat looks something like the following

ltisdmapencodingStyle=httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializergt

On the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server touse the bean serializer to translate it into a urnmyowncomobjectsMyObject SOAPobject and send it to the client

One the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like touse the serializer called myObjSer to translate the SOAP object into a Java MyObjectobject

The main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use inyour QName object

Note that it is often not necessary to write your own Serializer or Deserializer If yourclass has a get and a set for each attribute that needs to be marshalled you can just usethe Apache SOAP BeanSerializer class

bull What are the different SOAP encoding styles Which should I use

The Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserialzier for anXML element

The SOAP specification allows the encodingStyle attribute to hold multiple URIswhich denote increasingly general encoding rules What isnt defined however is how a

The Apache SOAP Project Documentation

Page 11Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP processor is to determine which encoding style to apply Consequently theApache SOAP library does not support this syntax and will always treat theencodingStyle attribute value as a single URI reference

1 SOAP Encoding

This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully insection 5 of the SOAP specification

2 XMI Encoding3 Literal XML Encoding

bull How do you serialize javautilDate objects

Use BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializeris planned that serializes using the ISO date format

Date objects should be converted to xsddate or xsdtimeInstant to be SOAPcompliant The SOAP spec says For simple types SOAP adopts all the types found inthe section Built-in datatypes of the XML Schema Part 2 Datatypes but not all havebeen implemented

bull How do you return a DOM Element from an RPC Call

The encoding style of a Call return is determined by the encoding style of the RequestDOM Elements use Literal XML encoding For example if a service accepts one StringParameter and returns an Element just set the encoding style for the call tohttpxmlapacheorgxml-soapliteralxml and the encoding style for the parameter tohttpschemasxmlsoaporgsoapencoding Thus part of your client code would looklike Call call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML ) String strparam = joebobVector params = new Vector() paramsaddElement( newParameter( strparam Stringclass strparamConstantsNS_URI_SOAP_ENC ) )

Service Handlers

bull What is an actor

Every SOAP message has primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipient

SOAP allows Header entries to be addressed to specific actors with the

The Apache SOAP Project Documentation

Page 12Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP-ENVactor attribute This attribute contains the URI that uniquely identifies theactor

bull What tools are available that use Apache SOAP

Brought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format thatdescribe SOAP services There is an IBM alphaWorks toolkit that generates Java serviceclient libraries and service handler skeletons from a WSDL document See the WSDLspecification and the IBM toolkit

bull How do I get the samples installed

For Tomcat put the soapjar and samples classes on the system classpath (ie in$TOMCAT_HOMEclasseslib) rather than in webappssoapWEB-INF

bull I am having problems configuring SOAP with Webspere

Apache SOAP has worked under every version of WebSphere from 11 to 302 It willhowever work out of the box on WebSphere 35 with fixpak 2 applied The WebSphereinstall instructions for that level are part of the current SOAP kit You can browse themonline Be sure to check the following items

1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even ifit is default(80) just mention it in the URL ashttpaaabbbcccdddportsoapservletrpcrouter

2 Verify that xerces is at the start of your path not only by setting it in the App but alsoin the websphere configuration files (adminconfig setupclientbat)

bull Does Apache SOAP work with Microsoft SOAP

Yes but you need to install a patch to the MS SOAP package One of the well-knowninteroperability problems between Apache 20 and MS Soap is that MS clients do notsend type information with each parameter and the Apache soap server will reject suchrequests

James Snell has provided a patch adding the typing It can be found at SOAP-WRC website

22 Apache-SOAP Users FAQ

221 Apache-SOAP Users FAQ

This FAQ is based on the questions and answers that appear on the Apache-SOAP UsersMailing ListIt is currently maintained by Jonathan Chawke and was last modified on Sat 15-Mar-20031227 GMT

The Apache SOAP Project Documentation

Page 13Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Corrections and suggestions for new questions are always welcome

Table of Contents Hot Topics This section answers questions that have beenappearing frequently on the mailing list11 Help Im getting this error Element must contain afaultcode element12 Help Im getting this error Unable to resolve namespace URI for xsd13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP service14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not found15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodError16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAP19 How can I view the raw XML data that is exchanged between a SOAP client andserver110 I cant get SOAP working with Tomcat 4 (Catalina) Help

General This section answers general questions21 Where can I get help on SOAP issue XYZ22 Where can I find mailing list archives for the soap-user mailing list23 Im just getting started with SOAP Where can I find a tutorial on SOAP programming24 Are there any other SOAP FAQs available25 Where can I download the SOAP specification document(s)26 Are there any good books on SOAP27 What other SOAP implementations are available28 What is meant by the phrase SOAP is a wire-level protocol29 How does SOAP compare with other XML protocols210 How do I use TcpTunnel and TcpTunnelGUI211 How do I use SOAP over SSL212 How do I use SOAP over SMTP213 What products are available that will let me use ASP or Perl as SOAP client214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could use215 Where do I find nightly builds of the POP3 and SMTP beans218 Is there a way to generate SOAP stubskeleton code from a deployment descriptor219 Is there a way to generate SOAP deployment descriptor from IDL

The Apache SOAP Project Documentation

Page 14Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

220 Is there any way of specifying a timeout for a SOAP method invocation222 Are there any ISPs that will host SOAP applications224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh start228 How do I tell my Apache SOAP client to use a proxy server229 How do I perform Proxy Authentication with my Apache SOAP client230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy server231 Are there any commercially ready servlet containers which will support Apache SOAPclients 232 Where can I find a list of public SOAP services that are available on the Internet234 What tools are available that use Apache SOAP236 How do I restrict access to the Apache SOAP administration client238 How can I get the IP address of a client that is using my SOAP Service240 Can a client programmatically deploy a SOAP service241 Id like to deploy multiple services using a single deployment descriptor file Is thispossible242 Will Apache SOAP support JAXM when its ready243 Will Apache SOAP support JAX-RPC

InstallationThis section helps resolve questions which arise when installing ApacheSOAP in a particular application server environment31 What jar files do I need to provide for Apache-SOAP clients32 How do I install Apache-SOAP on Tomcat 3x33 Can I install Apache-SOAP 21 on Tomcat 4034 How do I install Apache-SOAP on Bea WebLogic 5135 How do I install Apache-SOAP on Bea WebLogic 6036 How do I install Apache-SOAP on Bea WebLogic 61 beta37 How do I install Apache-SOAP on Resin38 How do I install Apache-SOAP on IBM WebSphere39 How do I install Apache-SOAP on Bluestone310 How do I install Apache-SOAP on Orion311 How do I install Apache-SOAP on Apache-JServ312 How do I install Apache-SOAP on iPlanet Web Server313 How do I install Apache-SOAP on iPlanet Application Server314 How do I install Apache-SOAP on Unifys ServletExec316 How do I install Apache-SOAP on Oracle 8i Application Server318 How do I install Apache-SOAP on Borland Application Server (BAS) 45

Troubleshooting This section answers general troubleshooting queries42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijob

The Apache SOAP Project Documentation

Page 15Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 12: The Apache SOAP Project Documentation

SOAP processor is to determine which encoding style to apply Consequently theApache SOAP library does not support this syntax and will always treat theencodingStyle attribute value as a single URI reference

1 SOAP Encoding

This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully insection 5 of the SOAP specification

2 XMI Encoding3 Literal XML Encoding

bull How do you serialize javautilDate objects

Use BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializeris planned that serializes using the ISO date format

Date objects should be converted to xsddate or xsdtimeInstant to be SOAPcompliant The SOAP spec says For simple types SOAP adopts all the types found inthe section Built-in datatypes of the XML Schema Part 2 Datatypes but not all havebeen implemented

bull How do you return a DOM Element from an RPC Call

The encoding style of a Call return is determined by the encoding style of the RequestDOM Elements use Literal XML encoding For example if a service accepts one StringParameter and returns an Element just set the encoding style for the call tohttpxmlapacheorgxml-soapliteralxml and the encoding style for the parameter tohttpschemasxmlsoaporgsoapencoding Thus part of your client code would looklike Call call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML ) String strparam = joebobVector params = new Vector() paramsaddElement( newParameter( strparam Stringclass strparamConstantsNS_URI_SOAP_ENC ) )

Service Handlers

bull What is an actor

Every SOAP message has primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipient

SOAP allows Header entries to be addressed to specific actors with the

The Apache SOAP Project Documentation

Page 12Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

SOAP-ENVactor attribute This attribute contains the URI that uniquely identifies theactor

bull What tools are available that use Apache SOAP

Brought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format thatdescribe SOAP services There is an IBM alphaWorks toolkit that generates Java serviceclient libraries and service handler skeletons from a WSDL document See the WSDLspecification and the IBM toolkit

bull How do I get the samples installed

For Tomcat put the soapjar and samples classes on the system classpath (ie in$TOMCAT_HOMEclasseslib) rather than in webappssoapWEB-INF

bull I am having problems configuring SOAP with Webspere

Apache SOAP has worked under every version of WebSphere from 11 to 302 It willhowever work out of the box on WebSphere 35 with fixpak 2 applied The WebSphereinstall instructions for that level are part of the current SOAP kit You can browse themonline Be sure to check the following items

1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even ifit is default(80) just mention it in the URL ashttpaaabbbcccdddportsoapservletrpcrouter

2 Verify that xerces is at the start of your path not only by setting it in the App but alsoin the websphere configuration files (adminconfig setupclientbat)

bull Does Apache SOAP work with Microsoft SOAP

Yes but you need to install a patch to the MS SOAP package One of the well-knowninteroperability problems between Apache 20 and MS Soap is that MS clients do notsend type information with each parameter and the Apache soap server will reject suchrequests

James Snell has provided a patch adding the typing It can be found at SOAP-WRC website

22 Apache-SOAP Users FAQ

221 Apache-SOAP Users FAQ

This FAQ is based on the questions and answers that appear on the Apache-SOAP UsersMailing ListIt is currently maintained by Jonathan Chawke and was last modified on Sat 15-Mar-20031227 GMT

The Apache SOAP Project Documentation

Page 13Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Corrections and suggestions for new questions are always welcome

Table of Contents Hot Topics This section answers questions that have beenappearing frequently on the mailing list11 Help Im getting this error Element must contain afaultcode element12 Help Im getting this error Unable to resolve namespace URI for xsd13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP service14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not found15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodError16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAP19 How can I view the raw XML data that is exchanged between a SOAP client andserver110 I cant get SOAP working with Tomcat 4 (Catalina) Help

General This section answers general questions21 Where can I get help on SOAP issue XYZ22 Where can I find mailing list archives for the soap-user mailing list23 Im just getting started with SOAP Where can I find a tutorial on SOAP programming24 Are there any other SOAP FAQs available25 Where can I download the SOAP specification document(s)26 Are there any good books on SOAP27 What other SOAP implementations are available28 What is meant by the phrase SOAP is a wire-level protocol29 How does SOAP compare with other XML protocols210 How do I use TcpTunnel and TcpTunnelGUI211 How do I use SOAP over SSL212 How do I use SOAP over SMTP213 What products are available that will let me use ASP or Perl as SOAP client214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could use215 Where do I find nightly builds of the POP3 and SMTP beans218 Is there a way to generate SOAP stubskeleton code from a deployment descriptor219 Is there a way to generate SOAP deployment descriptor from IDL

The Apache SOAP Project Documentation

Page 14Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

220 Is there any way of specifying a timeout for a SOAP method invocation222 Are there any ISPs that will host SOAP applications224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh start228 How do I tell my Apache SOAP client to use a proxy server229 How do I perform Proxy Authentication with my Apache SOAP client230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy server231 Are there any commercially ready servlet containers which will support Apache SOAPclients 232 Where can I find a list of public SOAP services that are available on the Internet234 What tools are available that use Apache SOAP236 How do I restrict access to the Apache SOAP administration client238 How can I get the IP address of a client that is using my SOAP Service240 Can a client programmatically deploy a SOAP service241 Id like to deploy multiple services using a single deployment descriptor file Is thispossible242 Will Apache SOAP support JAXM when its ready243 Will Apache SOAP support JAX-RPC

InstallationThis section helps resolve questions which arise when installing ApacheSOAP in a particular application server environment31 What jar files do I need to provide for Apache-SOAP clients32 How do I install Apache-SOAP on Tomcat 3x33 Can I install Apache-SOAP 21 on Tomcat 4034 How do I install Apache-SOAP on Bea WebLogic 5135 How do I install Apache-SOAP on Bea WebLogic 6036 How do I install Apache-SOAP on Bea WebLogic 61 beta37 How do I install Apache-SOAP on Resin38 How do I install Apache-SOAP on IBM WebSphere39 How do I install Apache-SOAP on Bluestone310 How do I install Apache-SOAP on Orion311 How do I install Apache-SOAP on Apache-JServ312 How do I install Apache-SOAP on iPlanet Web Server313 How do I install Apache-SOAP on iPlanet Application Server314 How do I install Apache-SOAP on Unifys ServletExec316 How do I install Apache-SOAP on Oracle 8i Application Server318 How do I install Apache-SOAP on Borland Application Server (BAS) 45

Troubleshooting This section answers general troubleshooting queries42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijob

The Apache SOAP Project Documentation

Page 15Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 13: The Apache SOAP Project Documentation

SOAP-ENVactor attribute This attribute contains the URI that uniquely identifies theactor

bull What tools are available that use Apache SOAP

Brought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format thatdescribe SOAP services There is an IBM alphaWorks toolkit that generates Java serviceclient libraries and service handler skeletons from a WSDL document See the WSDLspecification and the IBM toolkit

bull How do I get the samples installed

For Tomcat put the soapjar and samples classes on the system classpath (ie in$TOMCAT_HOMEclasseslib) rather than in webappssoapWEB-INF

bull I am having problems configuring SOAP with Webspere

Apache SOAP has worked under every version of WebSphere from 11 to 302 It willhowever work out of the box on WebSphere 35 with fixpak 2 applied The WebSphereinstall instructions for that level are part of the current SOAP kit You can browse themonline Be sure to check the following items

1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even ifit is default(80) just mention it in the URL ashttpaaabbbcccdddportsoapservletrpcrouter

2 Verify that xerces is at the start of your path not only by setting it in the App but alsoin the websphere configuration files (adminconfig setupclientbat)

bull Does Apache SOAP work with Microsoft SOAP

Yes but you need to install a patch to the MS SOAP package One of the well-knowninteroperability problems between Apache 20 and MS Soap is that MS clients do notsend type information with each parameter and the Apache soap server will reject suchrequests

James Snell has provided a patch adding the typing It can be found at SOAP-WRC website

22 Apache-SOAP Users FAQ

221 Apache-SOAP Users FAQ

This FAQ is based on the questions and answers that appear on the Apache-SOAP UsersMailing ListIt is currently maintained by Jonathan Chawke and was last modified on Sat 15-Mar-20031227 GMT

The Apache SOAP Project Documentation

Page 13Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Corrections and suggestions for new questions are always welcome

Table of Contents Hot Topics This section answers questions that have beenappearing frequently on the mailing list11 Help Im getting this error Element must contain afaultcode element12 Help Im getting this error Unable to resolve namespace URI for xsd13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP service14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not found15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodError16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAP19 How can I view the raw XML data that is exchanged between a SOAP client andserver110 I cant get SOAP working with Tomcat 4 (Catalina) Help

General This section answers general questions21 Where can I get help on SOAP issue XYZ22 Where can I find mailing list archives for the soap-user mailing list23 Im just getting started with SOAP Where can I find a tutorial on SOAP programming24 Are there any other SOAP FAQs available25 Where can I download the SOAP specification document(s)26 Are there any good books on SOAP27 What other SOAP implementations are available28 What is meant by the phrase SOAP is a wire-level protocol29 How does SOAP compare with other XML protocols210 How do I use TcpTunnel and TcpTunnelGUI211 How do I use SOAP over SSL212 How do I use SOAP over SMTP213 What products are available that will let me use ASP or Perl as SOAP client214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could use215 Where do I find nightly builds of the POP3 and SMTP beans218 Is there a way to generate SOAP stubskeleton code from a deployment descriptor219 Is there a way to generate SOAP deployment descriptor from IDL

The Apache SOAP Project Documentation

Page 14Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

220 Is there any way of specifying a timeout for a SOAP method invocation222 Are there any ISPs that will host SOAP applications224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh start228 How do I tell my Apache SOAP client to use a proxy server229 How do I perform Proxy Authentication with my Apache SOAP client230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy server231 Are there any commercially ready servlet containers which will support Apache SOAPclients 232 Where can I find a list of public SOAP services that are available on the Internet234 What tools are available that use Apache SOAP236 How do I restrict access to the Apache SOAP administration client238 How can I get the IP address of a client that is using my SOAP Service240 Can a client programmatically deploy a SOAP service241 Id like to deploy multiple services using a single deployment descriptor file Is thispossible242 Will Apache SOAP support JAXM when its ready243 Will Apache SOAP support JAX-RPC

InstallationThis section helps resolve questions which arise when installing ApacheSOAP in a particular application server environment31 What jar files do I need to provide for Apache-SOAP clients32 How do I install Apache-SOAP on Tomcat 3x33 Can I install Apache-SOAP 21 on Tomcat 4034 How do I install Apache-SOAP on Bea WebLogic 5135 How do I install Apache-SOAP on Bea WebLogic 6036 How do I install Apache-SOAP on Bea WebLogic 61 beta37 How do I install Apache-SOAP on Resin38 How do I install Apache-SOAP on IBM WebSphere39 How do I install Apache-SOAP on Bluestone310 How do I install Apache-SOAP on Orion311 How do I install Apache-SOAP on Apache-JServ312 How do I install Apache-SOAP on iPlanet Web Server313 How do I install Apache-SOAP on iPlanet Application Server314 How do I install Apache-SOAP on Unifys ServletExec316 How do I install Apache-SOAP on Oracle 8i Application Server318 How do I install Apache-SOAP on Borland Application Server (BAS) 45

Troubleshooting This section answers general troubleshooting queries42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijob

The Apache SOAP Project Documentation

Page 15Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 14: The Apache SOAP Project Documentation

Corrections and suggestions for new questions are always welcome

Table of Contents Hot Topics This section answers questions that have beenappearing frequently on the mailing list11 Help Im getting this error Element must contain afaultcode element12 Help Im getting this error Unable to resolve namespace URI for xsd13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP service14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not found15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodError16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAP19 How can I view the raw XML data that is exchanged between a SOAP client andserver110 I cant get SOAP working with Tomcat 4 (Catalina) Help

General This section answers general questions21 Where can I get help on SOAP issue XYZ22 Where can I find mailing list archives for the soap-user mailing list23 Im just getting started with SOAP Where can I find a tutorial on SOAP programming24 Are there any other SOAP FAQs available25 Where can I download the SOAP specification document(s)26 Are there any good books on SOAP27 What other SOAP implementations are available28 What is meant by the phrase SOAP is a wire-level protocol29 How does SOAP compare with other XML protocols210 How do I use TcpTunnel and TcpTunnelGUI211 How do I use SOAP over SSL212 How do I use SOAP over SMTP213 What products are available that will let me use ASP or Perl as SOAP client214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could use215 Where do I find nightly builds of the POP3 and SMTP beans218 Is there a way to generate SOAP stubskeleton code from a deployment descriptor219 Is there a way to generate SOAP deployment descriptor from IDL

The Apache SOAP Project Documentation

Page 14Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

220 Is there any way of specifying a timeout for a SOAP method invocation222 Are there any ISPs that will host SOAP applications224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh start228 How do I tell my Apache SOAP client to use a proxy server229 How do I perform Proxy Authentication with my Apache SOAP client230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy server231 Are there any commercially ready servlet containers which will support Apache SOAPclients 232 Where can I find a list of public SOAP services that are available on the Internet234 What tools are available that use Apache SOAP236 How do I restrict access to the Apache SOAP administration client238 How can I get the IP address of a client that is using my SOAP Service240 Can a client programmatically deploy a SOAP service241 Id like to deploy multiple services using a single deployment descriptor file Is thispossible242 Will Apache SOAP support JAXM when its ready243 Will Apache SOAP support JAX-RPC

InstallationThis section helps resolve questions which arise when installing ApacheSOAP in a particular application server environment31 What jar files do I need to provide for Apache-SOAP clients32 How do I install Apache-SOAP on Tomcat 3x33 Can I install Apache-SOAP 21 on Tomcat 4034 How do I install Apache-SOAP on Bea WebLogic 5135 How do I install Apache-SOAP on Bea WebLogic 6036 How do I install Apache-SOAP on Bea WebLogic 61 beta37 How do I install Apache-SOAP on Resin38 How do I install Apache-SOAP on IBM WebSphere39 How do I install Apache-SOAP on Bluestone310 How do I install Apache-SOAP on Orion311 How do I install Apache-SOAP on Apache-JServ312 How do I install Apache-SOAP on iPlanet Web Server313 How do I install Apache-SOAP on iPlanet Application Server314 How do I install Apache-SOAP on Unifys ServletExec316 How do I install Apache-SOAP on Oracle 8i Application Server318 How do I install Apache-SOAP on Borland Application Server (BAS) 45

Troubleshooting This section answers general troubleshooting queries42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijob

The Apache SOAP Project Documentation

Page 15Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 15: The Apache SOAP Project Documentation

220 Is there any way of specifying a timeout for a SOAP method invocation222 Are there any ISPs that will host SOAP applications224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh start228 How do I tell my Apache SOAP client to use a proxy server229 How do I perform Proxy Authentication with my Apache SOAP client230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy server231 Are there any commercially ready servlet containers which will support Apache SOAPclients 232 Where can I find a list of public SOAP services that are available on the Internet234 What tools are available that use Apache SOAP236 How do I restrict access to the Apache SOAP administration client238 How can I get the IP address of a client that is using my SOAP Service240 Can a client programmatically deploy a SOAP service241 Id like to deploy multiple services using a single deployment descriptor file Is thispossible242 Will Apache SOAP support JAXM when its ready243 Will Apache SOAP support JAX-RPC

InstallationThis section helps resolve questions which arise when installing ApacheSOAP in a particular application server environment31 What jar files do I need to provide for Apache-SOAP clients32 How do I install Apache-SOAP on Tomcat 3x33 Can I install Apache-SOAP 21 on Tomcat 4034 How do I install Apache-SOAP on Bea WebLogic 5135 How do I install Apache-SOAP on Bea WebLogic 6036 How do I install Apache-SOAP on Bea WebLogic 61 beta37 How do I install Apache-SOAP on Resin38 How do I install Apache-SOAP on IBM WebSphere39 How do I install Apache-SOAP on Bluestone310 How do I install Apache-SOAP on Orion311 How do I install Apache-SOAP on Apache-JServ312 How do I install Apache-SOAP on iPlanet Web Server313 How do I install Apache-SOAP on iPlanet Application Server314 How do I install Apache-SOAP on Unifys ServletExec316 How do I install Apache-SOAP on Oracle 8i Application Server318 How do I install Apache-SOAP on Borland Application Server (BAS) 45

Troubleshooting This section answers general troubleshooting queries42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijob

The Apache SOAP Project Documentation

Page 15Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 16: The Apache SOAP Project Documentation

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURI45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowed47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal1148 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangsfor the HTTP response to arrive Whats wrong49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManager410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I do411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatible413 Im getting an error telling me that class XMLParserLiason is not found What iswrong414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptor415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zip417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refused418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundary419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerException420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrong

Design and Architecture Issues This section aims to provide some opinions andsuggestions on design and architecture issues52 Can a SOAP server maintain session between multiple client invocations53 What is an actor54 Can Apache-SOAP handle large (multiple megabyte) files55 What is the best way to send a large file (multiple megabytes) with a soap request56 How do I add a file attachment to a SOAP response using MIME59 Is it possible to pass parameters to the constructor in a SOAP application 510 How do I write a SOAP service that maintains state across a session512 Is it possible to perform more than one invocation in a single SOAP request

The Apache SOAP Project Documentation

Page 16Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 17: The Apache SOAP Project Documentation

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do this515 I would like to pass a DOM Element as a parameter to a method How do I do this516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results available517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structure518 Are Apache SOAP calls synchronous or asynchronous519 What is the best way of sending XML data using SOAP520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XML521 How does SOAP compare with CORBA522 Is it possible to compress Apache SOAP data packets

SOAP and Namespaces This section discusses namespace issues61 What are all these SOAP Namespaces62 Do I need to use namespaces on my XML data63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from working

SOAP and Serialization This section discusses serialization issues71 How do I send user defined java objects using SOAP72 What are the different SOAP encoding styles Which should I use73 How do you serialize javautilDate objects77 How can I make a SOAP call which serializes both an xml literal and a string

WSDL This section answers Web Services Description Language (WSDL)questions81 Where can I find the WSDL specification document82 Does Apache SOAP use WSDL83 How can I generate a WSDL file for my SOAP service84 How can I generate Java code from an existing WSDL file85 Is there a command-line utility that I can use to generate WSDL stub and skeleton files86 Is there a tool that can validate WSDL87 Is there a command-line utility that I can use to generate a WSDL File88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)89 Is there a tool that can be used to parse WSDL files810 Where should I place my WSDL files811 Where can I find out about how WSDL and UDDI work together812 Where can I find out more about UDDI813 The WSTK proxygen tool generates a class that requires a URL parameter in the

The Apache SOAP Project Documentation

Page 17Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 18: The Apache SOAP Project Documentation

constructor What should I use814 Is there a simple tool which allows you to test a SOAP service using WSDL815 Is there a Java API for parsing and manipulating WSDL files

SOAP and NET This section answers questions which arise when integrating withMicrosofts NET platform91 Does Apache SOAP work with Microsoft SOAP92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) Client93 How do I Access a Microsoft SOAP Service using an Apache SOAP Client94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-895 Where can I find information about interoperating between an MS SOAP client and anApache SOAP service96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) Client97 Is there a mailing list for Microsoft SOAP users98 Where can I find an example of how to use the low-level MS SOAP API99 How do I maintain sessions between Apache-SOAP and MS SOAP910 How do I exchange complex types between Apache-SOAP and MS SOAP

Questions and Answers 1 Hot Topics11 Help Im getting this error Element must contain afaultcode elementThis is probably due to a bug in some newer releases of Xerces (eg 131) Try using Xerces143 123 or 130 instead (on both the client AND the server) - have a look onhttpxmlapacheorgdistxerces-j You should also make sure that xercesjar is the FIRSTentry in your classpath

12 Help Im getting this error Unable to resolve namespace URI for xsdEnsure that(a) You are using Xerces 144 143 123 or 130 (but NOT 131) - on both the client andthe server (if both are using Apache-SOAP)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH(d) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext

13 Help Im getting this error Unable to resolve target object when I try to invoke amethod on my SOAP serviceThis is a classpath problem Ensure that your SOAP service class is included in the classpathFor example if your class is called HelloServer and it is in directory foo then make surethat foo is in your Tomcat classpath when it launches

The Apache SOAP Project Documentation

Page 18Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 19: The Apache SOAP Project Documentation

14 Help I got this error message Fault String = orgw3cdomNode methodgetNamespaceURI() javalangString not foundThe most likely cause of this problem is a DOM level 1level 2 issueSOAP uses DOM level 2 and you may have DOM level 1 classes (ie another XML parserlibrary) included earlier in the classpath People often find another XML parser hiding inJAVA_HOMEjrelibextEnsure that(a) You are using Xerces 143 123 or 130 (but NOT 131)(b) xercesjar is the FIRST entry in your CLASSPATH as described in the Apache-SOAPinstallation instructions(c) There is ONLY ONE version of xercesjar in your CLASSPATH

15 Help The Samples wont work Every time I run a sample client I get this responseFault String = javalangNoSuchMethodErrorEnsure that(a) You have deployed the sample service you want to use(b) Xercesjar is the very first entry in your classpath (set this in tomcatbat or tomcatsh asper the SOAP installation instructions)(c) There are no other XML parsers in your classpath Some people have experienced thisproblem due to an early version of the JAXP package hiding in JAVA_HOMEjrelibext(d) The sample classes are in the servers CLASSPATH

16 Help Im getting this error Exception in thread main javalangNoSuchMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)The most likely cause of this problem is that you have more than one xml parser library (jar)in your classpath Finding the other xml library can be tricky Note that the JVM looks in twoplaces BEFORE it looks at classpath It finds Bootstrap classes and Extension classesfirst $JAVA_HOMEjrelibext is where the extension classes livePeople often find another XML parser hiding in JAVA_HOMEjrelibextLibraries to look for include xmljar xsltcjar The solution is to delete these jars (or movethem to a directory that isnt included in the classpath)Note also that JRun users got around this problem by adding the xerces jar to the JRunclasspath in ltjrungtlibglobalpropertiesjrunclasspath=cmyjarsxercesjar

17 Help Im getting this error Exception in thread main javalangAbstractMethodErrorat orgapachesoaputilxmlQNameltinitgt(QNamejava80)See Question 16 above

18 I think I have an XML parser library problem How can I determine exactly whichlibrary is being used by Apache SOAPMatt Duftler has kindly provided a JSP page can tell you whether a JAXP-compliant parser is

The Apache SOAP Project Documentation

Page 19Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 20: The Apache SOAP Project Documentation

being found what package the implementing classes of the orgw3cdom interfaces are fromand whether the orgw3cdom interfaces being resolved are namespace-aware The JSP file isavailable here httpmarctheaimsgroupcoml=soap-userampm=99669938017194ampw=2Note that SOAP 22 (or newer) is required

19 How can I view the raw XML data that is exchanged between a SOAP client andserverThere are a couple of tools which you can use to do this(1) TcpTunnel (textual interface) TcpTunnelGui (graphical interface) which are bothprovided with the standard Apache SOAP distribution Seehttpxmlapacheorgsoapfaqfaq_chawkehtmlQ2_10 for more information on how to usethese tools(2) UtilSnoop described as its author as somewhat more user friendly than TcpTunnelGuiIts available at httpwwwlanwcombooksjavasoap(3) Ionas XMLBus product seems to include a similar tool called the SOAP Message Spy -see httpwwwxmlbuscomwork

110 I cant get SOAP working with Tomcat 4 (Catalina) HelpYou probably need to do two things(1) Modify your catalinabat (or catalinash on Unix) file to include the soap libs in yourclasspath(2) Catalinas class loader operates different that Tomcat 3 so you need to put soapjar in theWEB-INF of the applications directory under a lib sub-dirFor more detailed instructions see herehttpmarctheaimsgroupcoml=soap-userampm=100802546024930ampw=2

2 General21 Where can I get help on SOAP issue XYZTry subscribing to the soap user mailing list on httpxmlapacheorgsoapmailhtml orsearching the mailing list archives (see Where can I find mailing list archives for thesoap-user mailing list for more information)You could also have a look at some other SOAP FAQs on this listhttpwwwSoapRPCcomfaqs

22 Where can I find mailing list archives for the soap-user mailing listTry httpmarctheaimsgroupcoml=soap-userampr=1ampw=2 or httparchivecovalentnet

23 Im just getting started with SOAP Where can I find a tutorial on SOAP programmingTry these linkshttpwww-106ibmcomdeveloperworkslibraryws-peer2httpwwwsoapusercomclient2htmlhttpwwwsoapusercomserver1html

The Apache SOAP Project Documentation

Page 20Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 21: The Apache SOAP Project Documentation

httpwwwperfectxmlcomarticlesxmlhellosoapasphttpwwwsoapwebservicescomarticleswhat_is_soapasp (shockwave flash presentation)httpwwwjavaprocomuploadfreefeaturesjavapro200104apr01prs0104prs0104-1asphttpdocspushtotestcom (Additional resources section)httpwwwsoaplitecomLINKShttpsoapmanilasitescomhttpwwwxmethodsnetgettingstartedapachehtml

24 Are there any other SOAP FAQs availableYes a list of FAQs is available here httpwwwSoapRPCcomfaqs You could also look atthe SOAP FAQ maintained by Developmentor httpwwwdevelopcomsoapsoapfaqhtm

25 Where can I download the SOAP specification document(s)SOAP 11 is here httpwwww3orgTRSOAPThere are also some other SOAP-related specs in this list httpwwww3orgTR

26 Are there any good books on SOAPSee httpwwwsoaprpccombooks

27 What other SOAP implementations are availableA good list of SOAP implementations is available herehttpdirectorygooglecomTopComputersProgrammingInternetWeb_ServicesSOAPImplementationsand here httpwwwsoap-wrccomwebservicesdefaultaspand here httpwwwsoapwareorgdirectory4implementations

28 What is meant by the phrase SOAP is a wire-level protocolA Wire level protocol is a protocol for Cross machine component interaction DCOM RMIand CORBA are popular wire level protocols SOAP is a new technology which brings aboutcross machine cross language and cross platform interoperability You can learn more aboutthis from the following siteshttpwwww3orgTRSOAPhttpwwwjavaworldcomjavaworldjw-03-2001jw-0330-soaphtmlhttpwwwmsdnmicrosoftcomsoap

29 How does SOAP compare with other XML protocolsSee XML Protocol Comparisons produced by the W3Chttpwwww3org20000329-XML-protocol-matrix

210 How do I use TcpTunnel and TcpTunnelGUIFor a short answer seehttpmarctheaimsgroupcoml=soap-userampm=98628744413873ampw=2 There is also agreat article on IBMs developerWorks sitehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-peer3dwzone=ws

The Apache SOAP Project Documentation

Page 21Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 22: The Apache SOAP Project Documentation

211 How do I use SOAP over SSLSee the Apache-SOAP SSL FAQhttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallFAQ_Tomcat_SOAP_SSLhtml

212 How do I use SOAP over SMTPSee the Apache-SOAP and SMTP FAQ available athttpxmlapacheorgsoapfaqfaq_chawke_smtphtml and in the soap user mail archiveshttpmarctheaimsgroupcoml=soap-userampm=98692249417026ampq=p3

213 What products are available that will let me use ASP or Perl as SOAP clientSee httpwwwsoap-wrccomwebservicesdefaultasp and alsohttpwwwsoaprpccomsoftware for lists of SOAP libspackages A popular Perlimplementation is SOAPLite - available at httpwwwsoaplitecom

214 Id like to write a SOAP client as a Java applet Are there any tiny SOAP clientlibraries I could useConsider using SoapRMI for your client It is 183KB (including full XML parser) and isavailable here httpwwwextremeindianaedusoaprmidownload For more details aboutits design see httpwwwextremeindianaedusoapYou could also consider using IBMs Web Services Development Environmenthttpwwwalphaworksibmcomtechwsde (warning it is a big download) Among otherthings it will automatically generate WSDL files from any java class or COM object createa browser-based client and deploy your services to Websphere or ApacheAlso have a look at KSoap - a small-footprint SOAP lib for J2MEhttpksoapenhydraorgindexhtmlSystinet (formerly Idoox) also provide a JavaScript-based SOAP implementation that enablesyou to invoke a SOAP request from a browser The JavaScript support is included in WASPLite You can download it from httpwwwsystinetcomdownloadhtml

215 Where do I find nightly builds of the POP3 and SMTP beansYoull find them here httpwwwalphaworksibmcomabnsf

218 Is there a way to generate SOAP stubskeleton code from a deployment descriptorYes you can use the IBM alphawork WSTK toolkithttpwwwalphaworksibmcomtechwebservicestoolkit

219 Is there a way to generate SOAP deployment descriptor from IDLIt might make more sense to transform IDL to WSDL otherwise you will lose informationregarding the syntax of method calls if you directly use the SOAP deployment descriptor

220 Is there any way of specifying a timeout for a SOAP method invocationIn Apache-SOAP version 21 you can set a timeout on the client side by usingSOAPHTTPConnection shc

The Apache SOAP Project Documentation

Page 22Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 23: The Apache SOAP Project Documentation

shc = new SOAPHTTPConnection()shcsetTimeout(5000) lt-- 5 secondsCall call = new Call()callsetSOAPTransport(shc)

222 Are there any ISPs that will host SOAP applicationsWe havent heard of any yet but there _are_ ISPs that host servlets and JSP pages so itsprobably just a matter of time- httpwwwservletscomisps- httpwwwadrenalinegroupcomjwsisphtml

224 Help I got the following error message SOAP Service Manager Unable to readDeployedServicesds assuming fresh startThis message will appear the first time you run SOAP as the file does not exist and needs tobe created for the first time Dont worry - it is just a warning not an error

228 How do I tell my Apache SOAP client to use a proxy serverHere is some sample code to do thisSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)Call call = new Call() prepare the service invocationcallsetSOAPTransport(conn) use the proxy

229 How do I perform Proxy Authentication with my Apache SOAP clientSee the sample code in the weather service client - it shows how to do proxy authenticationHere is some sample code tooSOAPHTTPConnection connection = new SOAPHTTPConnection()connectionsetProxyHost(proxy)connectionsetProxyPort(8080)setProxyUserName(username)setProxyPassword(password)

230 My Apache SOAP service needs to make connections to other Internet sites How do Iconfigure my SOAP service to use a proxy serverThere are at least two ways of doing this(1) Dynamically modify your system properties at execution timeProperties prop = SystemgetProperties()propput(httpproxyHostyourProxycom)propput(httpproxyPort80)(2) Let TOMCAT do the proxying for you If you are using Tomcat as a servlet engine youcan set the environment variable TOMCAT_OPTS as follows

The Apache SOAP Project Documentation

Page 23Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 24: The Apache SOAP Project Documentation

For a HTTP Proxyset TOMCAT_OPTS=-DProxyHost=yourproxyserver -DproxyPort=8080For a SOCKS Proxyset TOMCAT_OPTS=-DsocksProxyHost=yoursocksserver -DsocksProxyPort=1080

231 Are there any commercially ready servlet containers which will support Apache SOAPclients Yes here is a (probably incomplete) list (in no particular order) of servlet containers thatvarious SOAP-users have used to host Apache-SOAP services- Bea WebLogic 60 at httpwwwbeacom- Resin at httpwwwcauchocom- IBM WebSphere at httpwww-4ibmcomsoftwarewebservers- HP Bluestone at httpwwwbluestonecom- Orion at httpwwworionservercom- iPlanet Application Server at httpwwwiplanetcom- Borland Application Server at httpwwwborlandcom- ServletExec from Unify at httpwwwunifycomNote that we are not endorsing any of the above commercial products - just reporting whatpeople have mentioned on the soap-users mailing list Note that in most cases a little bit oftweaking is required to get Apache-SOAP working under a given application serverThe good news is that in most (if not all) cases these teething problems have already beenresolved by other SOAP users See Section 3 of this FAQ for more information

232 Where can I find a list of public SOAP services that are available on the InternetSalcentral maintain a searchable list of web services here httpwwwsalcentralcomXmethods have a list here as well httpwwwxmethodsnet

234 What tools are available that use Apache SOAPBrought to you by the same folks that brought you UDDI is the Web Services DefinitionLanguage WSDL is an XML schema that defines documents in XML format that describeSOAP services There is an IBM alphaWorks toolkit that generates Java service clientlibraries and service handler skeletons from a WSDL document See the WSDL specification(httpwww-106ibmcomdeveloperworkslibraryw-wsdlhtml) and the IBM toolkit(httpwwwalphaworksibmcomtechwebservicestoolkit)

236 How do I restrict access to the Apache SOAP administration clientThere are a number of possible solutions (none of which are perfect)- Modify your servlet containers security settings so that only certain IP addresses can accessthe admin page If you are running Tomcat with its security manager you can add an entryfor the soap webapp in the policy file located in the conf directory and then you can controlwhich IP addresses the webapp will accept connections from- Modify the code - see httpsoapmanilasitescomstoriesstoryReader$13

The Apache SOAP Project Documentation

Page 24Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 25: The Apache SOAP Project Documentation

- Modify your firewall configuration Some firewalls can filter on URLs and you could usethis to prevent accesses to the admin page (although this wouldnt prevent someone fromrunning the ServiceManagerClient directly)

238 How can I get the IP address of a client that is using my SOAP ServiceIf you add a SOAPContext Object as first Parameter in the signature of your SOAP-servicejava-method a SOAPContext Object is passed to your class egmymethod(SOAPContext inContext String inString)This SOAPContext object gives you access to the HttpSession HttpRequest HttpResponse(see java doc for details)So your SOAP service method can get the servlet request out of the context object and thencall the getRemoteAddr() method on the service request objectimport javaxservlethttpHttpServletRequest req =(HttpServletRequest)soapCtxgetProperty(orgapachesoapConstantsBAG_HTTPSERVLETREQUEST)String remoteIPAddress = reqgetRemoteAddr()NOTE this will only work where the client and server are both using the Apache SOAPlibraries

240 Can a client programmatically deploy a SOAP serviceYes you can do this using orgapachesoaputilConfigManager Have a look herehttpxmlapacheorgsoapdocsapiDocsorgapachesoaputilConfigManagerhtmldeploy(orgapachesoapserverDeploymentDescriptor)Remember that to deploy a service the service classes must already exist in the classpath onthe server All you are doing here is configuring Apache-SOAP so that it knows about yourservice

241 Id like to deploy multiple services using a single deployment descriptor file Is thispossibleYes it is Have a look herehttpmarctheaimsgroupcoml=soap-userampm=100109136124059ampw=2

242 Will Apache SOAP support JAXM when its readyThere are no plans at present to support JAXM (httpjavasuncomxmljaxm) in ApacheSOAP However there are plans to provide JAXM support in Axis(httpwsapacheorgaxis)

243 Will Apache SOAP support JAX-RPCThere are no plans at present to support JAX-RPC (httpjavasuncomxmljaxrpc) inApache SOAP However the Axis (httpwsapacheorgaxis) developers report that Axis isalready moving towards full compliance with the current JAX-RPC draft spec

3 Installation

The Apache SOAP Project Documentation

Page 25Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 26: The Apache SOAP Project Documentation

31 What jar files do I need to provide for Apache-SOAP clientsFor an Apache-SOAP 22 deployment you will need to include the following jars- xercesjar- soapjar- mailjar- activationjarThe Apache-SOAP client-side dependencies are described in more detail on the web-site inthe Installation section under the Client-Side Instructions heading Seehttpxmlapacheorgsoapdocs for this information

32 How do I install Apache-SOAP on Tomcat 3xFollow the instructions that are included with the Apache-SOAP distribution Make sure thatyou read the instructions carefully as there are a bunch of gotchasXmethods have a good tutorial which includes setup informationhttpwwwxmethodsnetgettingstartedapachehtml

33 Can I install Apache-SOAP 21 on Tomcat 40Catalina (Tomcat 4) uses a different class loading model to the tomcat 3 series so if youfollow the Tomcat instructions in the soap distribution when the soap web application isloaded it will not be able to find orgapachesoap or the SAX classes needed However itshould work if you put xercesjar and soapjar into the lib directory under WEB-INF underyour web application One SOAP user has provided a detailed description of their workingconfiguration herehttpmarctheaimsgroupcoml=soap-userampm=100199111401559ampw=2Another user (Tom Myers) reports that SOAP 22 seems to work fine in Tomcat 401without touching the catalinabat startup file just put your jar files soapjar etc into your[path-to-catalina]commonlibdirectory

34 How do I install Apache-SOAP on Bea WebLogic 51Dion Almaer has written an article about this and it has been included in the distribution Seehttpxmlapacheorgwebsrccvswebcgixml-soapjavadocsinstallweblogic51html

35 How do I install Apache-SOAP on Bea WebLogic 60Dion Almaer has written an article about this httpwwwalmaercomweblogic60htmlThere are some additional comments herehttpmarctheaimsgroupcoml=soap-userampm=98808422428291ampw=2

36 How do I install Apache-SOAP on Bea WebLogic 61 betaIt seems to be more or less the same process as that used for WebLogic 60 but there aresome (new) gotchas related to JAXP Seehttpxmlapacheorgsoapfaqfaq-for-WL61betahtml [note when WebLogic 61 is

The Apache SOAP Project Documentation

Page 26Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 27: The Apache SOAP Project Documentation

released we will merge this FAQ with the Apache SOAP install docs] andhttpmarctheaimsgroupcoml=soap-userampm=99270271408539ampw=2

37 How do I install Apache-SOAP on ResinUnder Resin 123 configure a web app to point to the soap webapp directory(ieltpath-to-apache-soapgtwebappssoap) See alsohttpmarctheaimsgroupcoml=soap-userampm=99650513909887ampw=2

38 How do I install Apache-SOAP on IBM WebSphereApache SOAP has worked under every version of WebSphere from 11 to 302 It will workout of the box on WebSphere 35 with fixpak 2 applied Wouter Cloetens has providedinstructions on using Apache-SOAP with IBM Websphere v1 v2 and v30 onhttpworkspotnet~zombiesoap There are also instructions for WebSphere v35 in theApache-SOAP distribution - seehttpxmlapacheorgwebsrccvswebcgi~checkout~xml-soapjavadocsinstallwebspherehtmlrev=11ampcontent-type=texthtmlamponly_with_tag=MAINBe sure to check the following items1 Explicitly set the port number that you have exposed the rpcrouter servlet on Even if it isdefault(80) just mention it in the URL as httpaaabbbcccdddportsoapservletrpcrouter2 Verify that xerces is at the start of your path not only by setting it in the App but also inthe websphere configuration files (adminconfig setupclientbat)

39 How do I install Apache-SOAP on BluestoneThe Bluestone people provide a download with instructions and sampleshttpgallerybluestonecomscriptsSaISAPIdllGalleryclasstechDownloadsindexjsp

310 How do I install Apache-SOAP on OrionHave a look here httpmarctheaimsgroupcoml=soap-devampm=97678072329144ampr=p3

311 How do I install Apache-SOAP on Apache-JServHere are some instructionshttpmarctheaimsgroupcoml=soap-userampm=98890652006035ampw=2

312 How do I install Apache-SOAP on iPlanet Web ServerSee Erik Onnens article herehttpmarctheaimsgroupcoml=soap-userampm=98753020626284ampr=p3

313 How do I install Apache-SOAP on iPlanet Application ServerSee the instructions on the iPlanetcom web sitehttpdeveloperiplanetcomappserversamplessoapdocsindexhtml

314 How do I install Apache-SOAP on Unifys ServletExecSee httpmarctheaimsgroupcoml=soap-userampm=97741067209680ampw=2

316 How do I install Apache-SOAP on Oracle 8i Application Server

The Apache SOAP Project Documentation

Page 27Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 28: The Apache SOAP Project Documentation

According to the Oracle folks SOAP should work under the latest production release ofOracle 8i which is Oracle 817 Earlier releases of Oracle 8i (eg 816) seem to be moreawkward the JVM bundled with 816 has a bug that affects Xerces See here for moreinformation httpmarctheaimsgroupcoml=soap-userampm=98200304522497ampw=2

318 How do I install Apache-SOAP on Borland Application Server (BAS) 45Installation of SOAP on BAS 45 is done in 3 steps1) Deploy the [soap install dir]webappssoapwar using the deploy tool2) Edit [BAS451 install dir]varservers[server name]admpropertiesiasconfig and add aline like addpath [xerces install dir]xercesjar at the end of the modifiable section3) Add the required libraries either in the appserver or in the webcontainerSee httpmarctheaimsgroupcoml=soap-userampm=99728307503567ampw=2 Thanks toLaurent Letellier and Colin Mondesir for this information

4 Troubleshooting42 Help Visual Age cant compile SOAP - it says Im missing package comibmxmijobThese classes can be downloaded fromhttpwwwalphaworksibmcomawnsftextformulabc977085639b0fb888256a10006 Themissing package is a xmisoapjar which contains the following filescomibmxmiframeworkcomibmxmijobcomibmxmiutility

43 Help My client sees error message SOAP-ENVServerBadTargetObjectURIThe most likely cause of this problem is a classpath error The class file that implements yourservice is not in the classpath ofthe server

45 Help I try to run my SOAP client I get this message Unsupported response contenttype texthtml must be textxml Response was HTTP Error 405 - Method NotAllowedCheck that your client is connecting to port 8080 (ie httplocalhost8080 rather thanhttplocalhost) You might accidentally be connecting to a web server (eg Apache or IIS)instead of your SOAPTomcat server

47 Help Im using Tomcat+SOAP on Linux When I try to access the SOAP admin pageTomcat crashes and I see this message HotSpot Virtual Machine Error Unexpected Signal11This may be related to a JDK 13 bug on Linux try- Using JDK 12- Using the -server or -client option on the JDK 13 JVM

48 I am running the SOAP TunnelGui on Red Hat Linux 70 Sometimes the client hangs

The Apache SOAP Project Documentation

Page 28Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 29: The Apache SOAP Project Documentation

for the HTTP response to arrive Whats wrongThis problem is due to a combination of the Sun JDK you are using and the glibc packagesinstalled in 70 Redhat has a patch for glibc which solves this problem (as well as a ton ofothers) Here is theadvisory and update httpwwwredhatcomsupporterrataRHBA-2000-079htmlYou should also make sure that the JVM is using the classiccompiler each time Do this by editing a file called jvmcfg andmaking sure classic is the first available option for the VM This fileis in $JAVA_HOMEjrelibYou might also consider switching to the IBM or Blackdown JDK if you continue to haveproblems

49 Help I just upgraded Apache-SOAP When I run the service manager I get the followingerror javaxservletServletException Cannot create bean of classorgapachesoapserverServiceManagerDelete the JSP work files that were stored by your JSP server so that they are re-generatedusing the new SOAP classes In the case of tomcat these should be in a directory that lookslike this $TOMCAT_HOMEworklocalhost_80802Fsoap

410 Help Apache wont integrate with IIS it says that the message content type should betextxml but it is read as textxml What do I doThis problem occurs because IIS sends this dataContent-Typetextxml charset=utf-8But Apache-SOAP sends this dataContent-Type textxml charset=utf-8(Note the space after Content-Type)The problem has been fixed - upgrade to v22 or later of Apache-SOAP and it should goaway

411 Help Im getting this error javaioInvalidClassExceptionorgapachesoapserverDeploymentDescriptor Local class not compatibleThe most likely cause of this problem is that you upgraded your JVM A class that isserialized can only be deserialized with the same version of the JVM Re-deploy yourservices using your new JVM and the problem should be solved

413 Im getting an error telling me that class XMLParserLiason is not found What iswrongThe orgapachexalanxpathxmlXMLParserLiason class used to be part of Apache SOAPbut it was discarded when Apache SOAP was made JAXP-compliant (in releases after v21)The problem is probably occurring because you are running old code (possibly an oldsample) against a newer version of Apache-SOAP

The Apache SOAP Project Documentation

Page 29Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 30: The Apache SOAP Project Documentation

414 Help Im getting this error message Unable to retrieve PropertyDescriptor forproperty checkMustUnderstands of class classorgapachesoapserverDeploymentDescriptorTry using a later version of Xerces such as 14 (youre probably using 12 or 131) and seeif the problem goes away Also make sure that you have removed all previous versions ofApache SOAP from your classpath

415 Help Im getting this error BSF Error Unable to load language javascript Im usingbsf 22 and jsjar from rhino14R3zipThis is a result of a code change that the Mozilla folks made which is notbackward-compatible You have two options(a) Upgrade to Rhino 15(b) Re-compile BSF against rhino14R3 The compiler will flag a line of code - remove thelast parameter from the function call on this line and the problem should go away

417 Help Im getting this error Caught SOAPException ltSOAP-ENVClientgt Erroropening socketconnection refusedThe problem is caused by one of the following(a) Your SOAP client isnt specifying the right port in the service URL eg It is usinghttplocalhost80soapservletrpcrouter but the SOAP service router is listening on port8080 (ie httplocalhost8080soapservletrpcrouter )(b) Your SOAP client isnt specifying the right path in the service URL eg it is usinghttplocalhost8080rpcrouter instead of httplocalhost8080soapservletrpcrouter(c) Your application serverservlet container (eg Tomcat) isnt running(d) If you are using Apache-SOAP in conjunction with a web server (eg Apache or IIS)ensure that the web server is also running

418 Help Im getting this error when I run one of the MIME samples Error parsingresponse javaxmailMessagingException Missing start boundaryEnsure that you have added activationjar and mailjar to your classpathThis exception can also be caused by an incorrect HTTP Post Content-Type header Forattachments it should look like thisContent-Type multipartrelated boundary=MIME_boundary type=textxmlstart=some-content-idIf you receive Content-Type multipartrelated then MimeMultipartparse() hunts for theboundary --null

419 Help Im getting this error javalangNoClassDefFoundErrorjavaxxmltransformTransformerExceptionThe javaxxmltransformTransformerException class is in the xalan library - seehttpxmlapacheorgxalan-jindexhtml Ensure that xalanjar is in your SOAP serversclasspath If youre using an XSLT library other than xalan make sure the jar defines

The Apache SOAP Project Documentation

Page 30Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 31: The Apache SOAP Project Documentation

javaxxmltransformTransformerException

420 Im getting a segmentation fault when I try to run SOAP on Red Hat Whats wrongTake a look at httpjavasuncomj2se13jreinstall-linuxhtml It describes a bug in javathat causes a segmentation fault The glibc-22x libraries dont correctly handle initial stacksizes larger than 6MbThere is a workaround Use ulimit -s 2048 in bash shell or limit stacksize 2048 in tcsh tolimit the initial thread stack to 2 MB

5 Design and Architecture Issues52 Can a SOAP server maintain session between multiple client invocationsYes Client-side cookie support was added to Apache SOAP by Sanjiva with the addition ofthe setMaintainSession function to the SOAPHTTPConnectionclassshc = new SOAPHTTPConnection ()shcsetMaintainSession( true ) NEW FUNCTIONcallsetSOAPTransport( shc )Check out the latest code from CVS and have a look atthe AddressBook2 sample for moredetails(youll need to at least get the latest Calljava and SOAPHTTOConnectionjava fromCVS)Note that session timeouts can be configured in the servlet container In the case of Tomcatthis is configured in the SOAP entry in webxml

53 What is an actorEvery SOAP message has a primary intended recipient An actor is a different messagerecipient that may recieve the message and possibly modify it before forwarding it on toeither the next actor or the final intended recipientSOAP allows Header entries to be addressed to specific actors with the SOAP-ENVactorattribute This attribute contains the URI that uniquely identifies the actor

54 Can Apache-SOAP handle large (multiple megabyte) filesYes People on the soap-user mailing have reported that they have been able to successfullytransfer files of up to 20Mb in size using Apache-SOAP

55 What is the best way to send a large file (multiple megabytes) with a soap requestAs a MIME attachment Note that this will use a lot of memory because in the currentApache-SOAP implementation the entire file is read into memory before it is sent Seehttpxmlapacheorgsoapdocsguideattachmentshtml for more information

56 How do I add a file attachment to a SOAP response using MIMESee(a) The documentation - httpxmlapacheorgsoapdocsguideattachmentshtml and(b) The code in the mime folder in the Apache SOAP samples directory

The Apache SOAP Project Documentation

Page 31Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 32: The Apache SOAP Project Documentation

59 Is it possible to pass parameters to the constructor in a SOAP application No unfortunately it isnt The SOAP server requires that you have a public no-argumentconstructor - this is what used to create an instance of your target service providerAn alternative to parameter passing is to load the information you need from a property fileor to set each parameter after object instantiation

510 How do I write a SOAP service that maintains state across a sessionBoth the client and the server have to be modified to use maintain state across a session(a) Setting the scope to Session tells the server-side to store the target object in the contextof the session You do this in the deployment descriptor (scope=Session)(b) The client side needs to be told to return the cookies that help the maintain sessions Build the callCall call = new Call() We require the session to be maintainedSOAPHTTPConnection conn = new SOAPHTTPConnection()connsetMaintainSession(true)callsetSOAPTransport(conn)See the samplesaddressbook2Main sample code for a detailed example of how to do this

512 Is it possible to perform more than one invocation in a single SOAP requestNo SOAP v11 (see httpwwww3orgTRSOAP) which is what Apache SOAPimplements does not allow that

513 I would like to write a SOAP service method that returns a DOM Document(orgw3cdomDocument) How do I do thisYou need to return a DOM Element rather than a Document and you need to specify the useof Literal XML encoding for the return value The encoding style of a Call return isdetermined by the encoding style of the Request DOM Elements use Literal XML encodingFor example if a service accepts one String Parameter and returns an Element just set theencoding style for the call to httpxmlapacheorgxml-soapliteralxml and the encodingstyle for the parameter to httpschemasxmlsoaporgsoapencoding Thus part of yourclient code would look likeCall call = new Call()callsetTargetObjectURI(urnsomeservice)callsetMethodName(callmethod)callsetEncodingStyleURI( ConstantsNS_URI_LITERAL_XML )String strparam = joebobVector params = new Vector()paramsaddElement( new Parameter( strparam Stringclassstrparam ConstantsNS_URI_SOAP_ENC ) )

The Apache SOAP Project Documentation

Page 32Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 33: The Apache SOAP Project Documentation

See the GetAllListings() method in the Addressbook sample for a more detailed example ofhow to control the return encoding style

515 I would like to pass a DOM Element as a parameter to a method How do I do thisTryparamsaddElement(new Parameter(name Elementclass rootConstantsNS_URI_LITERAL_XML) )Where- name is the name of the parameter expected by the SOAP service method- root is an object of type Element

516 What is the performance difference (if any) between SOAP and RMI Are there anybenchmark test results availableThere arent any official benchmark test results available but some ad hoc testing by SOAPusers suggests that RMI is about 5 times faster than an unoptimized SOAP implementationThe XML parser is considered to be the bottleneck in Apache SOAPBear in mind that- Apache SOAP implementations will be optimized in the future and RMI probably wont- The common expectation is that eventually SOAP implementations will provideperformance that is comparable to RMI- RMI is Java only SOAP isnt

517 I am writing a SOAP service which returns a set of data Is it better to return this data inan object or as an XML data structureIf the clients consuming the SOAP service are all written in Java then it is probably easier toreturn objects Otherwise you should probably return your data as XML (ie as DOMElements)

518 Are Apache SOAP calls synchronous or asynchronousIf youre using the HTTP transport then the calls are synchronous If youre using the SMTPtransport then calls are asynchronous A number of people have discussed the need toprovide one-way calls over HTTP - seehttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=one-wayampr=b

519 What is the best way of sending XML data using SOAPUnfortunately there isnt a definitive answer (not yet anyway)But heres a brief summary of the options(a) Send the XML as a string (works ok until the string gets large at which pointperformance really degrades)(b) Send the XML in the body of the Envelope (you need to marshall and unmarshall thedata)(c) Send the XML as an attachment inside a message (you dont need to worry about

The Apache SOAP Project Documentation

Page 33Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 34: The Apache SOAP Project Documentation

serialisation or marshalling) See the MIME sample SOAP application for details on how touse attachmentsFor more information have a browse through the archiveshttpmarctheaimsgroupcoml=soap-userampw=2ampr=1amps=Best+way+to+send+XMLampr=b

520 Does Apache SOAP use SAX or DOM for parsingrepresentation of XMLApache SOAP uses DOM Axis the next generation of Apache SOAP is based on SAX (andperforms significantly better as a result) See here for more informationhttpwsapacheorgaxis

521 How does SOAP compare with CORBASee this article on IBM developerWorkshttpwww-106ibmcomdeveloperworkswebserviceslibraryws-arc3

522 Is it possible to compress Apache SOAP data packetsNeither the SOAP standard (httpwwww3orgTRSOAP) nor the standard distribution ofApache SOAP provide support for compression However a number of Apache SOAP usershave suggested extensions that might allow data compression See for example RobertSchmitts comments and codehttpmarctheaimsgroupcoml=soap-userampm=100229134130643ampw=2

6 SOAP and Namespaces61 What are all these SOAP NamespacesSOAP uses a few different namespaces for different elements and attributes depending on therole that the data item in question plays in the message formatting handling andor encodingLooking at the Envelope element of a typical SOAP message we see the followingnamespace declarations1 xmlnsSOAP-ENV=httpschemasxmlsoaporgsoapenvelope2 xmlnsSOAP-ENC=httpschemasxmlsoaporgsoapencoding3 xmlnsxsi=httpwwww3org1999XMLSchema-instance4 xmlnsxsd=httpwwww3org1999XMLSchemawhere 1) is the SOAP Envelope namespace 2) is the SOAP Encoding namespace 3) is theXML Schema Instance namespace and 4) is the XML Schema Definition namespace SOAPdefines the first two namespaces and refers to the second two These namespaces reflect howall data type definitions in SOAP are delegated to XML SchemaThe SOAP Envelope namespace defines the Envelope Header and Body element namesand the encodingStyle actor and mustUnderstand attributesThe SOAP Encoding namespace defines the Array element and the arrayType attributeused to encode Vector and Array java objects This encoding technique is recommended forany linear list of objects - ie Java 2 Collection objects can and probably should use thisencoding approachThe XML Schema Instance namespace defines the type attribute which identifies the data

The Apache SOAP Project Documentation

Page 34Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 35: The Apache SOAP Project Documentation

type of an elementThe XML Schema namespace defines several datatypes used as values of the xsitypeattribute Examples include int String double and ur-type

62 Do I need to use namespaces on my XML dataThe short answer is yes but only a littleThe long answer is that the serialization registry is necessarily based on qualified namesThus if you are marshallingunmarshalling Java objects into XML Elements those elementnames will have to be namespace qualifiedAlthough it is technically possible to just use one of the SOAP namespaces it probably isnt agood idea unless the element name is actually defined in that namespace (ie defined by theSOAP specification - see httpwwww3orgTRSOAP)If you already have one or more namespaces use them If you need to generate a newnamespace use something like urnacmecorpcomwhatever as the URI when you registeran element name See Serialization below

63 What are all those namespace prefixes in my SOAP messages Wont they keepvalidation from workingThe Apache-SOAP library will generate namespace prefixes as needed to make sure that allnecessary namespaces are declared If the same namespace gets declared twice with twodifferent prefixes the qualified names should still match with any namespace awaresoftware A qualified name is the combination of the namespace URI plus the local part ofthe element name (the part after the prefix)SOAP-ENVEnvelopexmlnsacme=urnacmecorpcomnamespacens3GetData xmlnsns3=urnacmecorpcomnamespacens3GetDataIn this example the prefix can be ns3 or acme Either way it refers to the samenamespace and thus for any local name the same element or attribute

7 SOAP and Serialization71 How do I send user defined java objects using SOAPYou need to map the Java object to a SOAP XML Element name This is done using anXMLJavaMappingRegistry Typically youll want to use the derived classSOAPMappingRegistry which among other things supports primitive types Array andVector objects and the ability to be configured via an XML file(DeploymentDescriptorxml)Although not required by the SOAP specification the Apache library requires that all XMLElements be namespace qualified via the QName utility class You can use (almost) anything

The Apache SOAP Project Documentation

Page 35Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 36: The Apache SOAP Project Documentation

for the QName You might think of the first piece as a path and the second piece as aSOAP object You might want to use something like the followingSOAPMappingRegistry smr = new SOAPMappingRegistry()MyObjectSerialzier myObjSer = new MyObjectSerialzier()smrmapTypes( ConstantsNS_URI_SOAP_ENCnew QName(urnmyowncomobjects MyObject)Objectclass myObjSer myObjSer )Then when you deploy the service that you are calling you must have a mapping entry thatlooks something like the followingisdmap encodingStyle = httpschemasxmlsoaporgsoapencodingxmlnsx=urnmyowncomobjects qname=xMyObjectjavaType=commyownobjectsMyObjectjava2XMLClassName=commyownsoapMyObjectSerializerxml2JavaClassName=commyownsoapMyObjectSerializerOn the server side all of this (the deployment map) basically says that when you have acommyownobjectsPOBean object to return to the caller you want the SOAP server to usethe bean serializer to translate it into a urnmyowncomobjectsMyObject SOAP objectand send it to the clientOne the client side all of this (the mapTypes() method) says that when you get a SOAPurnmyowncomobjectsMyObject object from the SOAP server you would like to usethe serializer called myObjSer to translate the SOAP object into a Java MyObject objectThe main thing you have to do is make sure that the xmlns and qname values in yourdeployment descriptor file (or their equivalents in the GUI) match the values you use in yourQName objectNote that it is often not necessary to write your own Serializer or Deserializer If your classhas a get and a set for each attribute that needs to be marshalled you can just use the ApacheSOAP BeanSerializer class

72 What are the different SOAP encoding styles Which should I useThe Apache SOAP library uses the SOAP-ENVencodingStyle attribute as a lookupqualifier when locating a Serializer for a Java object or a Deserializer for an XML elementThe SOAP specification allows the encodingStyle attribute to hold multiple URIs whichdenote increasingly general encoding rules What isnt defined however is how a SOAPprocessor is to determine which encoding style to apply Consequently the Apache SOAPlibrary does not support this syntax and will always treat the encodingStyle attribute value asa single URI reference1 SOAP Encoding This encoding style is identified by the SOAP Encoding URIhttpschemasxmlsoaporgsoapencoding and is described fully in Section 5 of the SOAPspecification2 XMI Encoding3 Literal XML Encoding

The Apache SOAP Project Documentation

Page 36Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 37: The Apache SOAP Project Documentation

73 How do you serialize javautilDate objectsUse BeanSerializer Either add a mapping for date in the deployment xml file or callSOAPMappingRegistrymapTypes() in your application A more correct DateSerializer isplanned that serializes using the ISO date formatDate objects should be converted to xsddate (httpwwww3orgTRxmlschema-2date) orxsdtimeInstant (httpwwww3orgTRxmlschema-2timeInstant) to be SOAP compliantThe SOAP spec says For simple types SOAP adopts all the types found in the sectionBuilt-in datatypes of the XML Schema Part 2 Datatypes(httpwwww3orgTRSOAP_Toc478383514) but not all have been implemented

77 How can I make a SOAP call which serializes both an xml literal and a stringYou need to set different encoding styles for your parametersConsider the addressbook client parameter creationparamsaddElement(new Parameter(nameToLookup StringclassnameToLookup null))That Parameter constructor has the following signatureParameter(String name Class type Object value String encodingStyleURI)The last argument doesnt have to be null - you can set it to something likeConstantsNS_URI_SOAP_ENC or ConstantsNS_URI_LITERAL_XML

8 WSDL81 Where can I find the WSDL specification documentThe WSDL specification document is available at httpwwww3orgTRwsdl

82 Does Apache SOAP use WSDLA WSDL document does not actually get used directly by the Apache SOAP API in any wayIt is simply an XML grammer that allows non-Apache SOAP client applications to discoverthe methods and classes available in a SOAP service

83 How can I generate a WSDL file for my SOAP serviceYou can use IBM web services toolkit - WSTK - (classcomibmwstkswrapperuiSWrapperGUI) on httpwwwalphaworksibmcomtechwsde orIBM Web services development environment onhttpwwwibmcomdeveloperworkswebservicesYou could also consider using GLUE which includes a command line tool for staticgeneration of WSDL httpwwwthemindelectriccomThe Apache AXIS folks are also working on a tool called java2wsdl Seehttpwsapacheorgaxis for more informationSilverStream now provide a product called jBrokerWeb which includes compilers to convertWSDL to Java and vice versa Seehttpextendsilverstreamcomworkbenchappjspjbrokerwebjsp for more information

The Apache SOAP Project Documentation

Page 37Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 38: The Apache SOAP Project Documentation

84 How can I generate Java code from an existing WSDL fileWASP from Systinet (formerly Idoox) includes a tool called WSDLCompiler It is able togenerate Java and JavaScript code from WSDL 11 It is available athttpwwwsystinetcom from The Mind Electric includes a tool called wsdl2java whichalso does this See httpwwwthemindelectriccom

85 Is there a command-line utility that I can use to generate WSDL stub and skeleton filesYes - the IBM web services toolkit (httpwwwibmcomdeveloperworkswebservices)includes a command-line java application that should do what you wantcomibmwsdlMain -Note that(a) It is in the wsdljar library(b) Passing in - (without the apostrophes) gets you a list of available commands that theclass supports

86 Is there a tool that can validate WSDLYes Simon Fell has written a Schematron-based validator for SOAP oriented WSDLdocuments See here httpwwwpocketsoapcomwsdl Note that the current version onlychecks the relationships between the various parts of the WSDL it doesnt really checkanything in the schema sections yet A couple of folks on the schematron mailing list areworking on some XSD checking code and it will be added to the validator when its done

87 Is there a command-line utility that I can use to generate a WSDL FileYes - the IBM web services toolkit (WSTK) 23(httpwwwibmcomdeveloperworkswebservices) includes a utility called wsdlgen It isin WSTK_HOMEbinSee also the Open Source WSDL4J project onhttposssoftwareibmcomdeveloperworksprojectswsdl4j

88 Any one know is there any open source UDDI server implementation (the UDDI4Jserver is locked into DB2)Have a look at the following- Systinet (formerly Idoox) WASP httpwwwsystinetcom (not open source uses JDBC)- The Mind Electric GLUE httpwwwthemindelectriccom (not open source uses JDBC)- jUUDI on sourceforge at httpsourceforgenetprojectsuddi Its relatively young (ie thecurrent release is an alpha) but SOAP users report that the guy running the project is veryhelpful and that it looks like the code runs off whichever db platform you want Ensure youget the code from CVS not the (tarball) release- pUDDIng at httpwwwopensorcererorg (UDDI v20 on Oracle) The author is talkingabout adding support for other database platforms

89 Is there a tool that can be used to parse WSDL files

The Apache SOAP Project Documentation

Page 38Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 39: The Apache SOAP Project Documentation

Yes IBM have one The Web Services Description Language for Java Toolkit (WSDL4J)allows the creation representation and manipulation of WSDL documents describingservices See httposssoftwareibmcomdeveloperworksprojectswsdl4j

810 Where should I place my WSDL filesPut the files in a directory on your web server and make them available to SOAP clientsDont forget that to put them in a location where SOAP clients have adequate permissions todownload them (you can use your web browser to test downloadingviewing the WSDL file)

811 Where can I find out about how WSDL and UDDI work togetherHave a look here httpwwwuddiorgbestpracticeshtml

812 Where can I find out more about UDDIHave a look here httpwwwuddiorgwhitepapershtml

813 The WSTK proxygen tool generates a class that requires a URL parameter in theconstructor What should I useIm using the proxygen tool in IBM WSTK 24 to generate client proxy code from a WSDLfile My problem is that the proxy class it generates requires a URL parameter in theconstructor But I want to create the proxy for an implementation so the URL should beincluded in the class How do I do thisThe generated proxy class has a static fieldpublic static javanetURL[] _KnownServiceLocationsIn the constructor all known locations found in WSDL will be added to this field So whenyou create the proxy object use the first element of _KnownServiceLocations as the URL

814 Is there a simple tool which allows you to test a SOAP service using WSDLYes there is a very nice (and freely downloadable) Java application (with GUI) which cangenerate and interactively test WSDL For more information seehttpwwwsicsse~hamfors

815 Is there a Java API for parsing and manipulating WSDL filesYes Anne Thomas Manes reports that theres a new Java API in the works called JWSDL(JSR 110 - see httpwwwjcporgjsrdetail110jsp) Its based on the WSDL4J APIdeveloped by IBM You can obtain a preliminary implementation of JWSDL from IBM (itspart of the WSTK)Systinet (formerly Idoox) also includes a JWSDL library You can download SystinetsSOAP implementation (WASP) which includes full support for WSDL fromhttpwwwsystinetcom

9 SOAP and NET91 Does Apache SOAP work with Microsoft SOAPYes but with a number of gotchas You need to install a patch to the MS SOAP package

The Apache SOAP Project Documentation

Page 39Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 40: The Apache SOAP Project Documentation

One of the well-known interoperability problems between Apache 20 and MS Soap is thatMS clients do not send type information with each parameter and the Apache soap serverwill reject such requestsMicrosoft now have a useful resource page for interoperability (including articles specificallydiscussing integration with Apache SOAP)httpwwwmsdnmicrosoftcomlibrarydefaultaspurl=libraryen-usdnsrvspechtmlglobalxmlwebsrvinteropaspframe=trueJames Snell has provided a patch adding the typing It can be found at SOAP-WRC web site(httpwwwsoap-wrccomapache_ms_soap_interopzip)Both Apache and Microsoft are working hard to ensure interoperability between their SOAPimplementations (in case you dont believe us have a look herehttpmarctheaimsgroupcoml=soap-userampm=98505313219298ampw=2)There are other problems with SOAP interoperability (in general) which are discussed herehttpwww-106ibmcomdeveloperworkswebserviceslibraryws-interhtml

92 How do I Access a Apache SOAP Service using a Microsoft SOAP (VB) ClientSee httpmarctheaimsgroupcoml=soap-userampm=98683038702626ampw=2

93 How do I Access a Microsoft SOAP Service using an Apache SOAP ClientSee httpsupportmicrosoftcomdirectoryarticleaspid=q307279

94 Help My Apache SOAP Client cannot connect to a NET service - the server says itexpects textxml and doesnt understand textxml charset=utf-8There is also a kludgy workaround to allow an Apache-SOAP client to send the request withjust textxml in the Content-Type header See some of the examples egsamplesxmethodsGetTempjavaSOAP users have also commented that if you upgrade to MSSoap toolkit 20 beta2 (or evenrc0) this problem seems to go away

95 Where can I find information about interoperating between an MS SOAP client and anApache SOAP serviceHave a look herehttpxmlapacheorgsoapdocsguideinterophtmlhttpwww-106ibmcomdeveloperworkslibraryws-ref3n-ws-5241httpwwwperfectxmlcomarticlesxmlsoapguideasp

96 How do I Access a Apache SOAP Service using a Microsoft NET (Beta 2) ClientMicrosoft have a How To document herehttpsupportmicrosoftcomdirectoryarticleaspid=q307324See also httpsupportmicrosoftcomdirectoryarticleaspid=q307318

97 Is there a mailing list for Microsoft SOAP usersThe best place for support on the MS toolkits is probably the MS newsgroups- microsoftpublicxmlsoap

The Apache SOAP Project Documentation

Page 40Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 41: The Apache SOAP Project Documentation

- microsoftpublicxmlsoapsdk

98 Where can I find an example of how to use the low-level MS SOAP APIHere is a tutorial which shows how to write a SOAP client using the MS SOAP low-levelAPI httpwwwsoapusercomclient4html

99 How do I maintain sessions between Apache-SOAP and MS SOAPUnfortunately the SOAP specifications dont say anything about session maintenance soeach implementor has done something different MS-Soap maintains sessions through theIHeaderHandler interface Apache-SOAP uses cookiesCurrently MS-Soap and Apache Soap are not interoperable as far as session maintenance isconcerned this is because unlike Apache SOAP MS-SOAP does not allow you to set cookiesin the HTTP header

910 How do I exchange complex types between Apache-SOAP and MS SOAPThe Castor XML tool (httpwwwcastororg) is one way of doing this Andrew Fawcett ofCODA was kind enough to make some sample code available on the Castor web sitehttpwwwcastororgpresentationshtml

23 Making Apache SOAP Invocations using SMTP

231 Making Apache SOAP Invocations using SMTP

Jonathan Chawke 9th March 2001

2311 Introduction

This document provides an explanation of How Apache provides its SMTPtransport for SOAPHow to set up Apache SOAP on a server so that it can service requests via SMTPHow to write a client that makes a SOAP invocation using e-mail (a combination ofSMTP and POP)

2312 Assumptions

This document assumes that you have already installed Apache SOAP[httpxmlapacheorgsoapindexhtml] onto a Tomcat[httpjakartaapacheorgtomcatindexhtml] 32 JSPServlet containerBefore attempting to service SMTP SOAP messages ensure that your installation iscorrectly configured for HTTP SOAP (ie the SOAP sample applications work overHTTP)

2313 SOAP Over SMTP

SOAP a Transport-independent Protocol The writers of the SOAP 11 protocol[httpwwww3orgTRSOAP] note that SOAP can potentially be used in

The Apache SOAP Project Documentation

Page 41Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 42: The Apache SOAP Project Documentation

combination with a variety of other protocols however the only bindings defined inthis document describe how to use SOAP in combination with HTTP and HTTPExtension FrameworkOne of the nice things about SOAP is that it isnt restricted to a particular transportlayer Most - if not all - implementations are currently using HTTP to transport SOAPmessages but there is no reason why you cant use other layers such as SMTP

2314 Apache SOAP Provides an SMTP Transport

The Apache SOAP distribution includes classes which permit the servicing of SOAPrequests using e-mail It does this using a combination of SMTP[httpwwwfreesoftorgCIERFC821] and POP[httpwwwfreesoftorgCIERFC1725] A class called SMTP2HTTPBridge must berunning in a separate JVM on the server As the name suggests this class operatesas a bridge mapping requests between HTTP and SMTP Strictly speaking this isnot an independent SMTP transport - what it really does is convert e-mail SOAPmessages to and from HTTP SOAP messages Running the Apache SOAP SMTPBridge (Server) Ensure that the machine you are using is running POP3 and SMTPservices (or can access another machine that provides them) Note that the scriptsshown below assume that a POP3 service is running locally Download the POP3and SMTP jar files from the Apache SOAP web site (currently they are herehttpwwwapacheorgdynclosercgiwssoap) Note that these are IBM (and notSun) jars and they are also available from IBM athttpwwwalphaworksibmcomabnsftechreqsSMTP andhttpwwwalphaworksibmcomabnsftechreqsPOP3 respectively The SMTPbridge software uses these classes to send and receive e-mail messages Ensurethat the POP3 and SMTP jar files (pop3jar and smtpjar) are included in yourclasspath Create a new account (eg soaprouter) under which the SOAP bridge willexecute This makes life easier in the long term and avoids filling your mail box withloads of XML messages The Apache SOAP distribution includes a class that mapsrequests between HTTP and SMTP Login to the new account and launch this Javaclass - its called orgapachesoapserverSMTP2HTTPBridge Dont forget toinclude the pop3jar and smtpjar in your classpath or it wont work A sample (Unix)shell script to launch the class is provided herebinsh Launch Apache SOAP SMTP Bridge classpath to use for soap smtpSOAPCP=usrlocaljakartajarsxercesjarusrlocaljakartajarssoapjar add mail libs that thebridge requiresSOAPCP=usrlocaljakartasoaplibpop3jarusrlocaljakartasoaplibsmtpjar$SOAPCP Usage java orgapachesoapserverSMTP2HTTPBridge polldelay pop3host pop3loginpop3passwd httpurl smtphostname polldelay number of millisec to sleep between polls pop3host hostname of the POP3 server pop3login login ID of POP3 account pop3passwdPOP3 account password routerURL http URL of SOAP router to bridge to smtphostname SMTP

The Apache SOAP Project Documentation

Page 42Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 43: The Apache SOAP Project Documentation

server host name polldelay=30000 run every 30 seconds (for testing) pop3host=localhost assume pop3 server is running on local host pop3login=$USER assume we are running in adedicated soap bridge account pop3passwd=secret pop3 password for soap bridge goes here soap server url goes here (we assume its local)routerURL=httplocalhost8080soapservletrpcrouter smtphostname=yourmailserver youroutgoing mail servers name goes here run the bridge echo Running the SOAP Bridge using classpath $SOAPCP java -classpath$SOAPCP orgapachesoapserverSMTP2HTTPBridge $polldelay $pop3host $pop3login$pop3passwd $routerURL $smtphostname

If all goes well you should (periodically) see something like thisSMTP2HTTPBridge Polling for messages Status update Contacting hostlocalhost Status update Host contacted sending login information Status updateNo new messages on server Running an Apache SOAP Client using SMTP Setupa new e-mail account on a server that provides a POP3 service This account will beused to retrieve responses to SOAP requests You could use an existing e-mailaccount but its probably better to use a dedicated account Find an existing SOAPclient that makes invocations over HTTP and make a copy of the code Wellmodify the client to use SMTP instead of HTTP The first modification is thetransport instead of using the standard HTTP transport(orgapachesoaptransportSOAPHTTPConnection) we need to use an SMTP oneWe need a number of new parameters so that we can (i) send our SOAP request tothe appropriate location as an e-mail message and (ii) check our e-mail account fora response to our request name of out-going mailserver String smtpserver =outgoingmailserver String popserver = popservername name of incoming mailserver pop account to use for From field and to check for response String poplogin= soapresponse String poppasswd = secret password String fromaddress =poplogin + + popserver SOAPTransport ss = neworgapachesoaptransportsmtpSOAPSMTPConnection( fromreplyto address fromaddress subject SOAP SMTP Request (TEST) smtpServer smtpserver popPollDelay in millis 30000 popServer popserver popLogin poplogin popPassword poppasswd ) The next modification we make is to theURL that is used for the request Instead of creating a http URL we create amailto URL (warning the mailto protocol handler is not directly supported by theMicrosoft Java SDK - you need some classes that are in Suns JDK) The addressused in the URL should be the name of the account used by the SOAP SMTP bridgeapplication (eg the soaprouter account described in the previous section) URL url= new URL(mailtosoaproutersoapserveryourdomaincom) Setup a new calland tell it to use our SMTP transport instead of HTTP build the callorgapachesoaprpcCall call = new Call() callsetSOAPTransport(ss) use smtptransport instead of http The rest of the SMTP SOAP client code should be the sameas HTTP SOAP client code Note that there is a sample application calledGetQuoteSMTPjava in samplesstockquote which demonstrates a SOAPSMTP client

The Apache SOAP Project Documentation

Page 43Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 44: The Apache SOAP Project Documentation

2315 Further Information

SOAP The SOAP Protocol httpwwww3orgTRSOAP Apache SOAPhttpxmlapacheorgsoap Post Office Protocol (POP) rfc1725 - POP3 - Post OfficeProtocol version 3 [httpwwwfreesoftorgCIERFC1725] rfc1082 - POP3 -Extended Service Offerings [httpwwwfreesoftorgCIERFC1082] rfc1734 - POP3- AUTHentication command [httpwwwfreesoftorgCIERFC1734]

24

25 RPC Response Encoding Styles

251 RPC Response Encoding Styles

Since the SOAP specification does not describe how to specify what encodingStyle to use forthe response to an RPC request Apache SOAPs RPCJavaProvider employs a simplealgorithm to choose an appropriate encodingStyle

First the method call element is examined for an encodingStyle attribute If there is noencodingStyle attribute on the call element each parameter element is then examined indocument order for encodingStyle attributes The value specified in the first encodingStyleattribute encountered is used If none of the parameter elements have an encodingStyleattribute SOAP Encoding (section 5 of the SOAP specification) is used

Put another way if the call element specifies an encodingStyle it is used for the response Ifthe call element does not specify an encodingStyle the first parameter element-specifiedencodingStyle is used If none of the parameter elements specify an encodingStyle or if thereare no parameter elements SOAP Encoding is used by default

Lets work through a couple of examples by answering several common questions

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request

Answer Simply set the desired response encodingStyle as the encodingStyle of the callobject

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement

The Apache SOAP Project Documentation

Page 44Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles
Page 45: The Apache SOAP Project Documentation

Note See samplesaddressbookGetAllListings for a complete example

Question How do I tell an Apache SOAP server (using the RPCJavaProvider ie providertype=java in the deployment descriptor) to use literalXML encodingStyle for the responseto my RPC request and still send parameters using SOAP encoding

Answer Set the desired response encodingStyle as the encodingStyle of the call object andset each parameters encodingStyle individually

Build the call Call call = new Call() configure the call (ie targetObjectURImethodName typeMappings etc) callsetEncodingStyleURI(ConstantsNS_URI_LITERAL_XML) Vector params =new Vector() A simple type paramsaddElement(new Parameter(quantityintclass new Integer(123) ConstantsNS_URI_SOAP_ENC)) A complex(user-defined) type paramsaddElement(new Parameter(address Addressclassaddr ConstantsNS_URI_SOAP_ENC)) callsetParams(params) make theinvocation and cast the value carried in the return parameter to anorgw3cdomElement Authors Matthew J Duftler and Dirck Hecking

The Apache SOAP Project Documentation

Page 45Copyright copy 1999-2003 The Apache Software Foundation All rights reserved

  • 1 SOAP
    • 11 WebServices - SOAP
      • 111 WebServices - SOAP - Introduction
        • 1111 October 15 2003 - WS-SOAP WebSite Renewed
        • 1112 September 15 2003 - CVS Repository Has Moved
        • 1113 October 27 2002 - Nightly Builds Have Moved
        • 1114 June 10 2002 - Version 231 Released
        • 1115 May 31 2002 - Version 23 Released
        • 1116 May 30 2001 - Version 22 Released
        • 1117 February 5 2001 - Version 21 Released
        • 1118 About Apache SOAP
        • 1119 License Information
            • 12 WebServices - SOAP
              • 121 WebServices - SOAP - General Features
              • 122 WebServices - SOAP - Implementation Restrictions
                • 13
                • 14 WebServices - SOAP
                  • 141 WebServices - SOAP - Who We Are
                    • 15 WebServices - SOAP
                      • 151 The Soap Users List
                      • 152 The Soap Developer List
                        • 16 WebServices - SOAP
                          • 161 June 10 2002 - Version 231
                          • 162 May 31 2002 - Version 23
                          • 163 May 30 2001 - Version 22
                          • 164 February 5 2001 - Version 21
                          • 165 August 18 2000 - Version 20
                          • 166 June 4 2000 - Version 12
                              • 2 FAQ
                                • 21 Apache SOAP Frequently Asked Questions (FAQ)
                                  • 211 Apache SOAP Frequently Asked Questions (FAQ)
                                    • 22 Apache-SOAP Users FAQ
                                      • 221 Apache-SOAP Users FAQ
                                        • 23 Making Apache SOAP Invocations using SMTP
                                          • 231 Making Apache SOAP Invocations using SMTP
                                            • 2311 Introduction
                                            • 2312 Assumptions
                                            • 2313 SOAP Over SMTP
                                            • 2314 Apache SOAP Provides an SMTP Transport
                                            • 2315 Further Information
                                                • 24
                                                • 25 RPC Response Encoding Styles
                                                  • 251 RPC Response Encoding Styles