Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 48250 invoked from network); 3 Jun 2005 10:25:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Jun 2005 10:25:38 -0000 Received: (qmail 98098 invoked by uid 500); 3 Jun 2005 10:25:35 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 98062 invoked by uid 500); 3 Jun 2005 10:25:35 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 98049 invoked by uid 99); 3 Jun 2005 10:25:34 -0000 X-ASF-Spam-Status: No, hits=-9.7 required=10.0 tests=ALL_TRUSTED,NORMAL_HTTP_TO_IP,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 03 Jun 2005 03:25:29 -0700 Received: (qmail 48166 invoked by uid 65534); 3 Jun 2005 10:25:19 -0000 Message-ID: <20050603102519.48165.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r179765 - in /webservices/axis/trunk/java/modules/samples/src/userguide: clients/ clients/ClientUtil.java clients/EchoClient.java clients/PingClient.java example1/META-INF/service.xml example1/MyService.java example2/ example2/META-INF/ example2/META-INF/service.xml example2/MyService.java Date: Fri, 03 Jun 2005 10:25:18 -0000 To: axis-cvs@ws.apache.org From: jaliya@apache.org X-Mailer: svnmailer-1.0.0-dev X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: jaliya Date: Fri Jun 3 03:25:15 2005 New Revision: 179765 URL: http://svn.apache.org/viewcvs?rev=3D179765&view=3Drev Log: Sample Services Added: webservices/axis/trunk/java/modules/samples/src/userguide/clients/ webservices/axis/trunk/java/modules/samples/src/userguide/clients/Clien= tUtil.java webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoC= lient.java webservices/axis/trunk/java/modules/samples/src/userguide/clients/PingC= lient.java webservices/axis/trunk/java/modules/samples/src/userguide/example2/ webservices/axis/trunk/java/modules/samples/src/userguide/example2/META= -INF/ webservices/axis/trunk/java/modules/samples/src/userguide/example2/META= -INF/service.xml webservices/axis/trunk/java/modules/samples/src/userguide/example2/MySe= rvice.java Modified: webservices/axis/trunk/java/modules/samples/src/userguide/example1/META= -INF/service.xml webservices/axis/trunk/java/modules/samples/src/userguide/example1/MySe= rvice.java Added: webservices/axis/trunk/java/modules/samples/src/userguide/clients/Cl= ientUtil.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/userguide/clients/ClientUtil.java?rev=3D179765&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/userguide/clients/Clien= tUtil.java (added) +++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/Clien= tUtil.java Fri Jun 3 03:25:15 2005 @@ -0,0 +1,52 @@ + +package userguide.clients; + +import org.apache.axis.om.OMAbstractFactory; +import org.apache.axis.om.OMElement; +import org.apache.axis.om.OMNamespace; +import org.apache.axis.om.OMFactory; +import org.apache.axis.soap.SOAPEnvelope; +import org.apache.axis.soap.SOAPFactory; + +/* + * Copyright 2001-2004 The Apache Software Foundation. + *=20 + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= . + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +public class ClientUtil { + + public static OMElement getEchoOMElement(){ + OMFactory fac =3D OMAbstractFactory.getOMFactory(); + OMNamespace omNs =3D fac.createOMNamespace("http://example1.org/ex= ample1", "example1"); + OMElement method =3D fac.createOMElement("echo", omNs); + OMElement value =3D fac.createOMElement("Text", omNs); + value.addChild(fac.createText(value, "Axis2 Echo String ")); + method.addChild(value); + + return method; + } + public static OMElement getPingOMElement(){ + OMFactory fac =3D OMAbstractFactory.getOMFactory(); + OMNamespace omNs =3D fac.createOMNamespace("http://example1.org/ex= ample1", "example1"); + OMElement method =3D fac.createOMElement("ping", omNs); + OMElement value =3D fac.createOMElement("Text", omNs); + value.addChild(fac.createText(value, "Axis2 Ping String ")); + method.addChild(value); + + return method; + } + + +} Added: webservices/axis/trunk/java/modules/samples/src/userguide/clients/Ec= hoClient.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/userguide/clients/EchoClient.java?rev=3D179765&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoC= lient.java (added) +++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoC= lient.java Fri Jun 3 03:25:15 2005 @@ -0,0 +1,67 @@ +package userguide.clients; + +import org.apache.axis.Constants; +import org.apache.axis.addressing.EndpointReference; +import org.apache.axis.addressing.AddressingConstants; +import org.apache.axis.clientapi.Call; +import org.apache.axis.engine.AxisFault; +import org.apache.axis.om.OMElement; + +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.namespace.QName; +import java.io.StringWriter; + +/* + * Copyright 2001-2004 The Apache Software Foundation. + *=20 + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= . + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +public class EchoClient { + private static String IP=3D"http://127.0.0.1:8080"; + private static EndpointReference targetEPR =3D new EndpointReference(A= ddressingConstants.WSA_TO, + IP + "/axis2/services/MyService/echo"); + private static QName operationName =3D new QName("echo"); + private static String value; + + public static void main(String[] args) throws AxisFault { + + try { + OMElement payload =3D ClientUtil.getEchoOMElement(); + Call call =3D new Call(); + call.setTo(targetEPR); + call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRAN= SPORT_HTTP, false); + + + OMElement result =3D (OMElement) call.invokeBlocking(operation= Name.getLocalPart(), + payload); + StringWriter writer =3D new StringWriter(); + result.serializeWithCache(XMLOutputFactory.newInstance().creat= eXMLStreamWriter(writer)); + writer.flush(); + value=3D writer.toString(); + System.out.println(value); + + } catch (AxisFault axisFault) { + value =3D axisFault.getMessage(); + + } catch (XMLStreamException e) { + value =3D e.getMessage(); + + } + + } + + +} Added: webservices/axis/trunk/java/modules/samples/src/userguide/clients/Pi= ngClient.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/userguide/clients/PingClient.java?rev=3D179765&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/userguide/clients/PingC= lient.java (added) +++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/PingC= lient.java Fri Jun 3 03:25:15 2005 @@ -0,0 +1,53 @@ +package userguide.clients; + +import org.apache.axis.engine.AxisFault; +import org.apache.axis.clientapi.Call; +import org.apache.axis.clientapi.MessageSender; +import org.apache.axis.addressing.EndpointReference; +import org.apache.axis.addressing.AddressingConstants; +import org.apache.axis.Constants; +import org.apache.axis.om.OMElement; +import org.apache.axis.soap.SOAPEnvelope; + +import javax.xml.stream.XMLStreamWriter; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.FactoryConfigurationError; +import javax.xml.namespace.QName; +import java.net.URL; +import java.net.MalformedURLException; +import java.io.StringWriter; + +/** + * Created by IntelliJ IDEA. + * User: Jaliya + * Date: Jun 3, 2005 + * Time: 2:11:25 PM + */ +public class PingClient { + private static String IP=3D"http://127.0.0.1:8080"; + private static EndpointReference targetEPR =3D new EndpointReference(A= ddressingConstants.WSA_TO, + IP + "/axis2/services/MyService/echo"); + private static QName operationName =3D new QName("echo"); + private static String value; + public static void main(String[] args) throws AxisFault{ + + try { + OMElement payload =3D ClientUtil.getPingOMElement(); + + MessageSender msgSender=3D new MessageSender(); + msgSender.setTo(targetEPR); + msgSender.setSenderTransport(Constants.TRANSPORT_HTTP); + + msgSender.send("ping",payload); + + + + } catch (AxisFault axisFault) { + value =3D axisFault.getMessage(); + + } + } + + +} Modified: webservices/axis/trunk/java/modules/samples/src/userguide/example= 1/META-INF/service.xml URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/userguide/example1/META-INF/service.xml?rev=3D179765&r1=3D179764&r2= =3D179765&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/userguide/example1/META= -INF/service.xml (original) +++ webservices/axis/trunk/java/modules/samples/src/userguide/example1/META= -INF/service.xml Fri Jun 3 03:25:15 2005 @@ -7,6 +7,6 @@ - + Modified: webservices/axis/trunk/java/modules/samples/src/userguide/example= 1/MyService.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/userguide/example1/MyService.java?rev=3D179765&r1=3D179764&r2=3D179= 765&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/userguide/example1/MySe= rvice.java (original) +++ webservices/axis/trunk/java/modules/samples/src/userguide/example1/MySe= rvice.java Fri Jun 3 03:25:15 2005 @@ -2,6 +2,10 @@ =20 import org.apache.axis.om.OMElement; =20 +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamException; +import java.io.StringWriter; + /** * Created by IntelliJ IDEA. * User: Jaliya @@ -9,13 +13,20 @@ * Time: 2:17:58 PM */ public class MyService { - public OMElement echo(OMElement element){ + public OMElement echo(OMElement element) throws XMLStreamException { + + StringWriter writer =3D new StringWriter(); + element.serializeWithCache(XMLOutputFactory.newInstance().createXM= LStreamWriter(writer)); + writer.flush(); + + System.out.println(writer.toString()); + element.getNextSibling(); element.detach(); return element; } =20 - public void ping(OMElement element){ - //Do the ping + public void ping(OMElement element) { + //Do the ping } } Added: webservices/axis/trunk/java/modules/samples/src/userguide/example2/M= ETA-INF/service.xml URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/userguide/example2/META-INF/service.xml?rev=3D179765&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/userguide/example2/META= -INF/service.xml (added) +++ webservices/axis/trunk/java/modules/samples/src/userguide/example2/META= -INF/service.xml Fri Jun 3 03:25:15 2005 @@ -0,0 +1,12 @@ + + + This is a sample Web Service with two operations,echo and ping. + + userguide.exampl= e1.MyService + + + + + + + \ No newline at end of file Added: webservices/axis/trunk/java/modules/samples/src/userguide/example2/M= yService.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/userguide/example2/MyService.java?rev=3D179765&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/userguide/example2/MySe= rvice.java (added) +++ webservices/axis/trunk/java/modules/samples/src/userguide/example2/MySe= rvice.java Fri Jun 3 03:25:15 2005 @@ -0,0 +1,10 @@ +package userguide.example2; + +/** + * Created by IntelliJ IDEA. + * User: Jaliya + * Date: Jun 3, 2005 + * Time: 2:41:19 PM + */ +public class MyService { +}