Consulting help wanted for short project: migrating Axis 1.4 service to Axis2
I need help with a short (3 to 5 day) project migrating an existing Axis 1.4 service to Axis2. Details, including where to send bids, are at http://www.pineneedleconsulting.com/axis2migration.html. (My apologies if this posting is not appropriate for this list.) Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is it possible?
John Delaney wrote: Fabricio It is entirely possible. You have to make sure that you define the interface properly on both sides. Use the xsd:AnyType to describe you java object. The only things that doesn't work completely are the signatures of the methods in your web service, get used to giving each method a unique name. Yes, it's possible, but do you really want to? Usually, the main motivation for using web services is interoperability with other platforms. You want your web service to be able to service requests from .NET clients, Perl clients, COBOL clients, etc. The service's WSDL is a contract; it should completely describe all messages that might be sent, and using xsd:anyType makes your contract useless to your clients. (Yes, I know .NET does it all the time; the result is that many .NET services can be consumed only by .NET clients.) If you really need to pass around generic Java objects, RMI is a better choice than web services. Mike
Re: Extracting Operation Name from a SOAP envelope
Supposing I've to extract the operation name from a SOAP Envelope I got into my code, can I safely assume that for all styles and uses (doc-lit, rpc-enc) the first child element of body has its localPart as the operation Name, or are there any hitches in making that decision You can assume this for rpc/encoded but not for document/literal. Basic doc-lit sends and receives documents defined by schemata external to the web service (i.e. XSD files included in the WSDL contract) and it doesn't require an enclosing element named after the operation. Right, and this is explicitly stated in the WS-I Basic Profile 1.0: R2710 The operations in a wsdl:binding in a DESCRIPTION MUST result in wire signatures that are different from one another. The Profile defines the "wire signature" of an operation in a wsdl:binding to be the fully qualified name of the child element of the soap:Body of the SOAP input message it describes...In the case of rpc-literal binding, the operation name is used as a wrapper for the part accessors. In the document-literal case, since a wrapper with the operation name is not present, the message signatures must be correctly designed so that they meet this requirement. I believe that's why Axis defines an element in the definition in server-config.wsdd: http://www.ltree.com/types"; xmlns:xsd="http://www.w3.org/2001/XMLSchema";> The defines a mapping between the child element of the SOAP Body in the request ("qname" attribute) to the method in the implementation class ("name" attribute). If the operation follows the wrapper-style convention, Axis doesn't need the definition. Mike
Re: java.lang.reflect.InvocationTargetException
Andy, Do you really want a message style service? Or is your true goal to have a document/literal service where you have control over the wsdl and schema? Axis message-style services are a real pain because (a) you have to use SAAJ, and (b) they're not portable to other Java web service toolkits. If what you really want is just a doc/lit service, I've found that it's much easier to start with the wsdl and schema that you want, and then generate service source files using "WSDL2Java --server-side". Here's what I do: 1. copy an existing doc/lit service WSDL file 2. edit the WSDL to define a new portType, new operations, etc. Import schemas using the or elements. The WTP plugin for Eclipse has a nice WSDL editor. 3. validate your WSDL using the Analyzer from the WS-I Interoperability Testing Tools (http://ws-i.org/deliverables/workinggroup.aspx?wg=testingtools) 4. run "WSDL2Java --server-side" to generate template source files and JAX-RPC value types (JavaBeans) that allow you to work with the SOAP elements without having to resort to SAAJ. (The generated deploy.wsdd will define the service's style="wrapped", which is just another flavor of "document".) 5. edit the generated service implementation class [service-name]SoapBinding.java and add business logic as needed 6. deploy the service as usual Since the new releases of Axis have much better support for doc/lit services than the old releases, you may never need to use Axis message style services. Mike A Yang wrote: Hi there, I'm trying to create a very simple Message style service in Axis 1.2.1 running in Tomcat 5.5.9 and JDK 1.5.0_04-b05 on Windows XP. I have a simple class: package com.xyz.testbed; import javax.xml.soap.*; public class CheckValue { public void foo(SOAPEnvelope req, SOAPEnvelope resp) { try { SOAPBody respbody = resp.getBody(); } catch(Exception e) {} } } with a deploy.wsdd that looks like: http://xml.apache.org/axis/wsdd/"; xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"; xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance";> I deploy it using the AdminClient and it reports everything is fine. The server-config.wsdd has the following: However, when I try to invoke the service from a test client using: SOAPConnection conn = SOAPConnectionFactory.newInstance().createConnection(); SOAPMessage response = conn.call(smsg, "http://localhost:8080/axis/services/Monkey";); // smsg is a SOAPMessage created from a string - this was taken from samples.message.TestMsg I get the following response: mlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";> soapenv:Server.userException java.lang.reflect.InvocationTargetException xmlns:ns1="http://xml.apache.org/axis/";>workstation I can invoke the sample.message.TestMsg no problem (I don't get a response, but I think that's correct? Haven't run this using TCPMonitor yet) What does the InvocationTargetException usually indicate? I've tried implementing my service as both: public void foo(SOAPEnvelope req, SOAPEnvelope resp) and public void foo(SOAPEnvelope req, SOAPEnvelope resp) throws javax.xml.soap.SOAPException but both produce the same result. Any thoughts? Thanks in advance, Andy __ Find your next car at http://autos.yahoo.ca
Re: creating WSDL contract
Plorks mail wrote: can anyone give me an example of writing a WSDL contract so i can later do wsdl2java? > > i'm after an example that retruns xml/arrays/strings Example WSDL and imported schema below. Note the updatePatientRecord element has a child named visitDetails that is declared with maxOccurs="unbounded". This is the WS-I recommendation for handling arrays. To generate template Java files and deploy.wsdd: java org.apache.axis.wsdl.WSDL2Java --server-side --package mypackage --output . OfficeVisitService.wsdl Generate server-config.wsdd using AdminClient or using the Admin utility: java org.apache.axis.utils.Admin -server deploy.wsdd what editors are best to create the wsdl file? The WTP Eclipse plug-in includes a very nice WSDL editor: www.eclipse.org/webtools Cape Science offers a free stand-alone WSDL editor: www.capescience.com/soa Mike Service WSDL http://www.ltree.com/wsdl/officevisit"; xmlns:impl="http://www.ltree.com/wsdl/officevisit"; xmlns:tns="http://www.ltree.com/types"; xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; > http://www.ltree.com/types"; xmlns:tns="http://www.ltree.com/types"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified"> http://localhost:8080/schemas/PatientRecord.xsd"; /> http://schemas.xmlsoap.org/soap/http"/> http://localhost:8080/ex51solBonus/services/OfficeVisitService"/> PatientRecord.xsd Schema == http://www.ltree.com/types"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:tns="http://www.ltree.com/types"; elementFormDefault="qualified">
Re: Web Sevice Auto Deployment
Raj, I don't know if this will help, but try changing the style attribute in your definition from "document" to "wrapped" Re: deploying without AdminClient You're correct: as long as server-config.wsdd is in WEB-INF, you don't need to run AdminClient. And AdminService is a huge security hole in a production system, so delete the definition for both AdminService and Version from your server-config.wsdd. If you want still want to use deploy.wsdd (e.g., you generated deploy.wsdd with WSDL2Java --server-side), generate server-config.wsdd with the Admin utility: java org.apache.axis.utils.Admin -server deploy.wsdd Hope this helps, Mike [EMAIL PROTECTED] wrote: Thanks Feng! why do I get this error ? AxisFault faultCode: {http://xml.apache.org/axis/}Client faultSubcode: faultString: No such operation 'inquiryRequest' I am able to go http://testserver:9080/WSWAR/services/DataInquiry and it says *DataInquiry* Hi there, this is an AXIS service! /Perhaps there will be a form for invoking the service here.../ This means the webservice is available.. but I don't know why it gives me No such operation error. I deployed the same one on my PC it works fine .. but I need to deploy it in the server *"Feng Xie \(fxie\)" <[EMAIL PROTECTED]>* 09/01/2005 03:21 PM Please respond to axis-user To: cc: Subject:RE: Web Sevice Auto Deployment Raj: I agree with your understanding about the deployment based my own experience. Baseline: while the Axis engine is not running, direct editting of server-config.wsdd will has the same effect of running ClientAdmin while the Axis engine is running. Feng *From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] * Sent:* Thursday, September 01, 2005 3:11 PM* To:* [EMAIL PROTECTED] Subject:* Web Sevice Auto Deployment Hello I created a simple Web Application in WSAD and deployed it successfully in my WebSphere Test Environment that comes with WSAD. I ran axis AdminClient to deploy the web service and noted that it created server-config.wsdd under WEB-INF/classes on my workspace http://xml.apache.org/axis/wsdd/"; xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";> F value="org.apache.axis.attachments.AttachmentsImpl"/> type="java:org.apache.axis.transport.local.LocalResponder"/> type="java:org.apache.axis.handlers.http.URLMapper"/> type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/> use="literal"> value="com.ws.datainquiry.DataInquirySOAPBindingSkeleton"/> deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns1:InvalidDataFormatException" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.ws.datainquiry.exceptions.InvalidDataFormatException" xmlns:ns1="java:com.ws.exceptions"/> deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns2:inquiryResponse" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.ws.datainquiry.InquiryResponse" xmlns:ns2="urn:DataInquiry2"/> deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns3:inquiryRequest" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.ws.datainquiry.InquiryRequest" xmlns:ns3="urn:DataInquiry2"/> http://xml.apache.org/axis/wsdd/ http://xml.apache.org/axis/wsdd/ value="org.apache.axis.transport.http.QSListHandler"/> value="org.apache.axis.transport.http.QSWSDLHandler"/> value="org.apache.axis.transport.http.QSListHandler"/> value="org.apache.axis.transport.http.QSMethodHandler"/> value="org.apache.axis.transport.http.QSMethodHandler"/> value="org.apache.axis.transport.http.QSWSDLHandler"/> Then I created a WAR file and deployed it in Websphere Application Server .. I notice that my DataInquiry Web service is listed as one of the service . if I go the http://testserver:9080/WSWAR/services.( Remember I did not *RUN *the admin client to deploy the service on the application server) when I try to invoke the service I am getting a RemoteException with an AxisFault shown below AxisFault faultCode: {http://xml.apache.org/axis/}Client faultSubcode: faultString: No such operation 'inquiryRequest' My understanding was.. if I have the service defined in the server-config.wsdd I don't need to run the admin client on the Application Server inorder to deploy the web service on the application server.. since it is defined on server-config.wsdd .. axis will auto deploy the service..( I don't know the mechanism behind admin and version web servies , how they are auto deployed ) PLEASE correct me if I am wrong ( I hope so)... I wanted to run the AdminClient but I don't have any
Re: java to wsdl: How to generate minOccurs="0" instead of nillable="true"
Martin Grotzke wrote: Thank you for your answer, Mike! We're using beehive for webservice development, and until now we tried to do as most as possible starting from java. If there's no way to tell java2wsdl to use minOccurs, it's probably the best to define the types using schema, to go partially the contract-first way. In many cases, this seems to be the most reliable way to get what you want. Btw, the concrete problem that we had has to do with C# / .NET 1.1: if you send an empty xml-element (as you showed below) for some primitive C#-type (e.g. int, long), then the .NET deserializer crashes, as it cannot parse the empty value. If you do not send this empty element (which is forced by minOccurs="0" as it seems), the .NET deserializer does his job. I've only seen Java2WSDL define nillable="true" on non-primitives (Strings, value types, etc.) If Java2WSDL is adding nillable="true" to primitives, it may be an Axis bug. You may want to look on Bugzilla to see if anyone has reported it yet. Regards, Mike Thanx again, Martin On Tue, 2005-08-30 at 10:16 -0400, Mike Woinoski wrote: Martin, I don't think there is a Java2WSDL option that adds minOccurs="0" to an element definition. However, you can edit the WSDL manually and add it yourself (sounds like a good job for an Ant task or shell script.) BTW, an element can have both nillable="true" and minOccurs="0". The semantics of these attributes is different: nillable="true" allows an XML element to have a value equivalent to a Java null reference: <... xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";> This is different than a plain empty element: which is equivalent to a Java String object with length 0. Mike Martin Grotzke wrote: Hello, when creating the wsdl from java classes, is there's any way to change the default behavior from generating nillable="true" to minOccurs="0" (for interop with .net)? thanx in advance, martin
Re: problem building Axis 1.2.1 from source
Venkat, Here are the classpaths: sun.boot.class.path= C:\Home\Java\jwsdp\jaxp\lib\endorsed\dom.jar C:\Home\Java\jwsdp\jaxp\lib\endorsed\sax.jar C:\Home\Java\jwsdp\jaxp\lib\endorsed\xalan.jar C:\Home\Java\jwsdp\jaxp\lib\endorsed\xercesImpl.jar C:\Home\Java\jwsdp\jaxp\lib\jaxp-api.jar C:\Home\Java\j2se\jre\lib\rt.jar C:\Home\Java\j2se\jre\lib\i18n.jar C:\Home\Java\j2se\jre\lib\sunrsasign.jar C:\Home\Java\j2se\jre\lib\jsse.jar C:\Home\Java\j2se\jre\lib\jce.jar C:\Home\Java\j2se\jre\lib\charsets.jar C:\Home\Java\j2se\jre\classes classpath: C:\Home\Java\axis\lib\xercesImpl.jar C:\Home\Java\axis\lib\xmlParserAPIs.jar C:\Home\Java\axis\${xalan-unbundled.jar} C:\Home\Java\axis\${xml-apis.jar} C:\Home\Java\axis\${xerces.jar} C:\Home\Java\axis\test\lib\jakarta-oro-2.0.5.jar C:\Home\Java\axis\test\lib\xmlunit1.0.jar C:\Home\Java\axis\lib\jsse.jar C:\Home\Java\axis\lib\JimiProClasses.zip C:\Home\Java\axis\lib\activation.jar C:\Home\Java\axis\lib\mailapi.jar C:\Home\Java\j2se\lib\tools.jar C:\Home\Java\axis\${j2ee.jar} C:\Home\Java\axis\lib\junit.jar C:\Home\Java\axis\${servlet.jar} C:\Home\Java\axis\lib\axis-ant.jar C:\Home\Java\axis\lib\axis.jar C:\Home\Java\axis\lib\commons-discovery-0.2.jar C:\Home\Java\axis\lib\commons-httpclient-3.0-rc2.jar C:\Home\Java\axis\lib\commons-logging-1.0.4.jar C:\Home\Java\axis\lib\jaxrpc.jar C:\Home\Java\axis\lib\log4j-1.2.8.jar C:\Home\Java\axis\lib\mailapi_1_3_1.jar C:\Home\Java\axis\lib\saaj.jar C:\Home\Java\axis\lib\servlet.jar C:\Home\Java\axis\lib\wsdl4j-1.5.1.jar C:\Home\Java\jwsdp\server\lib\catalina-ant.jar C:\Home\Java\jwsdp\jaxp\lib\jaxp-api.jar C:\Home\Java\jwsdp\jaxp\lib\endorsed\xercesImpl.jar C:\Home\Java\jwsdp\jaxp\lib\endorsed\xalan.jar C:\Home\Java\jwsdp\jaxp\lib\endorsed\sax.jar C:\Home\Java\jwsdp\jaxp\lib\endorsed\dom.jar C:\Home\Java\jwsdp\apache-ant\lib\ant.jar C:\Home\Java\jwsdp\apache-ant\lib\ant-trax.jar C:\Home\Java\jwsdp\apache-ant\lib\ant-nodeps.jar C:\Home\Java\jwsdp\apache-ant\lib\ant-launcher.jar C:\Home\Java\jwsdp\apache-ant\lib\ant-junit.jar C:\Home\Java\axis\build\classes C:\Home\Java\axis\build\tools C:\Home\Java\axis\build\lib\axis-ant.jar Thanks, Mike Venkat Reddy wrote: This must be because of using JRE 5.0, which uses DOM-3. You can fix this either simply using a 1.4.2 JRE or ensuring Xerces 2.6.2 is in classpath. How does your classpath looks like as emitted by ant while running "ant clean compile"? - venkat On 8/30/05, Mike Woinoski <[EMAIL PROTECTED]> wrote: I'm trying to rebuild axis.jar from the Axis 1.2.1 source. "ant compile" generates a number of errors like the following: C:\Home\Java\axis\src\org\apache\axis\SOAPPart.java:90: org.apache.axis.SOAPPart is not abstract and does not override abstract method renameNode(org.w3c.dom.Node,java.lang.String,java.lang.String) in org.w3c.dom.Document public class SOAPPart extends javax.xml.soap.SOAPPart implements Part ^ I've tried it with Java 5.0 and Java 1.4.2 (using Ant 1.6.2), resetting JAVA_HOME for the different compilers, but I get the same errors. Is the compiler using the wrong version of the Xerces libraries? Should I be using an older compiler (JDK 1.3?) Thanks, Mike
Re: problem building Axis 1.2.1 from source
In an response to a old post about this same problem, Dims said: > The jdk15 comes with dom3 which is a not compatible with SAAJ 1.2 > spec. can you please drop the xercesImpl.jar and xmlParserAPIs.jar in > java/lib directory. if that does not work, please drop them into > JDK15\jre\lib\endorsed directory (as per > http://java.sun.com/j2se/1.4.2/docs/guide/standards/). I touched xercesImpl.jar and xmlParserAPIs.jar from axis/lib, then copied them into several directories under the JDK installation: JAVA_HOME/jre/lib JAVA_HOME/jre/lib/endorsed (removed dom.jar, etc.) JAVA_HOME/lib However, in all cases the compiler still uses the class files from rt.jar. What other settings are needed to convince the compiler to use the classes in the axis jar files? Thanks, Mike Mike Woinoski wrote: I'm trying to rebuild axis.jar from the Axis 1.2.1 source. "ant compile" generates a number of errors like the following: C:\Home\Java\axis\src\org\apache\axis\SOAPPart.java:90: org.apache.axis.SOAPPart is not abstract and does not override abstract method renameNode(org.w3c.dom.Node,java.lang.String,java.lang.String) in org.w3c.dom.Document public class SOAPPart extends javax.xml.soap.SOAPPart implements Part ^ I've tried it with Java 5.0 and Java 1.4.2 (using Ant 1.6.2), resetting JAVA_HOME for the different compilers, but I get the same errors. Is the compiler using the wrong version of the Xerces libraries? Should I be using an older compiler (JDK 1.3?) Thanks, Mike
Re: java to wsdl: How to generate minOccurs="0" instead of nillable="true"
Martin, I don't think there is a Java2WSDL option that adds minOccurs="0" to an element definition. However, you can edit the WSDL manually and add it yourself (sounds like a good job for an Ant task or shell script.) BTW, an element can have both nillable="true" and minOccurs="0". The semantics of these attributes is different: nillable="true" allows an XML element to have a value equivalent to a Java null reference: <... xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";> This is different than a plain empty element: which is equivalent to a Java String object with length 0. Mike Martin Grotzke wrote: Hello, when creating the wsdl from java classes, is there's any way to change the default behavior from generating nillable="true" to minOccurs="0" (for interop with .net)? thanx in advance, martin
problem building Axis 1.2.1 from source
I'm trying to rebuild axis.jar from the Axis 1.2.1 source. "ant compile" generates a number of errors like the following: C:\Home\Java\axis\src\org\apache\axis\SOAPPart.java:90: org.apache.axis.SOAPPart is not abstract and does not override abstract method renameNode(org.w3c.dom.Node,java.lang.String,java.lang.String) in org.w3c.dom.Document public class SOAPPart extends javax.xml.soap.SOAPPart implements Part ^ I've tried it with Java 5.0 and Java 1.4.2 (using Ant 1.6.2), resetting JAVA_HOME for the different compilers, but I get the same errors. Is the compiler using the wrong version of the Xerces libraries? Should I be using an older compiler (JDK 1.3?) Thanks, Mike
passing parameters to a JAX-RPC message handler
Is there a clean way to pass parameters to a JAX-RPC message handler? For example, I have a JAX-RPC client that uses stubs generated by WSDL2Java to create a message. However, the service WSDL doesn't describe the message format completely (e.g., an element in the schema has a child), so I need to tweak the message using SAAJ in a message handler. How do I pass data (e.g., values for a SQL query) from the JAX-RPC code to the message handler code? The only thing I found in the JAX-RPC API that allows us to configure a handler is the HandlerInfo class, so something like the following may work: MyServiceLocator stubFactory = ...; Iterator it = stubFactory.getHandlerChain().iterator(); // List of HandlerInfo boolean found = false; while (it.hasNext() && !found) { HandlerInfo hf = (HandlerInfo) it.next(); if (hf.getHandlerClass().equals(client.msghndl.ClientMessageHandler.class)) { found = true; Map handlerConfig = hf.getHandlerConfig(); if (handlerConfig == null) { handlerConfig = new HashMap(); hf.setHandlerConfig(handlerConfig); } handlerConfig.put("status", "overdue"); } } But this seems like an awful lot of work to do something very simple. Is there an easier way? Thanks, Mike