Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 54770 invoked from network); 23 Apr 2005 20:03:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 23 Apr 2005 20:03:04 -0000 Received: (qmail 51057 invoked by uid 500); 23 Apr 2005 20:03:21 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 51039 invoked by uid 500); 23 Apr 2005 20:03:20 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: List-Post: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 51024 invoked by uid 99); 23 Apr 2005 20:03:20 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of soactive@gmail.com designates 64.233.170.203 as permitted sender) Received: from rproxy.gmail.com (HELO rproxy.gmail.com) (64.233.170.203) by apache.org (qpsmtpd/0.28) with ESMTP; Sat, 23 Apr 2005 13:03:20 -0700 Received: by rproxy.gmail.com with SMTP id 1so79726rny for ; Sat, 23 Apr 2005 13:02:48 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=EKOcbmnzpOgo3Av6W9xDXuxKkECDftFuK66NoDXhuNpm6tG3f2KwKdDwDlMv60ElxbNyoH7TXNxUxSY7sd52bSejmXPhwAZqtRWiEKedeNhmTLYS7W6PGdU452ClfuonGEKIwe0odPzviHSWY83fDMo/BRTAXU8Q/U3w0bV/c9E= Received: by 10.11.119.13 with SMTP id r13mr401474cwc; Sat, 23 Apr 2005 13:02:48 -0700 (PDT) Received: by 10.11.117.20 with HTTP; Sat, 23 Apr 2005 13:02:48 -0700 (PDT) Message-ID: Date: Sat, 23 Apr 2005 13:02:48 -0700 From: Soactive Inc Reply-To: Soactive Inc To: axis-user@ws.apache.org Subject: ProxyService implementation Issues (Axis 1.2RC3) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Environment: Apache Tomcat 5.0.24, JDK 1.4.2, Apache Axis 1.2RC3 I am using the ProxyService provided in the samples package as a starting point for implementing my own ProxyService class that would act as a proxy for web services. Using this design, I am able to connect to some services that happen to reside on the same axis server as the proxy service but having some issues when I try to connect to external services - e.g. http://www.xignite.com/xInsider.asmx?WSDL. Please note that the client seems to be working just fine (simply change binding address in the code to the endpoint URL) if I bypass the proxy. The exception I am getting indicates that its not even reaching the endpoint (note 404 error) - I did ensure that I am able to manually access the URL for both the service address as well as the WSDL file. Any pointers to resolving this issue is much appreciated. I am first appending the exception I am getting and then the rest of my cod= e. Thanks, -Arun ***************************************************************************= ************* EXCEPTION ***************************************************************************= ************* ##### Printing Request Message.... IBM Symbol##### Request URL: http://localhost: 8080/axis/services/ProxyService AxisFault faultCode: {http://xml.apache.org/axis/}HTTP faultSubcode: faultString: (404)Object Not Found faultActor: faultNode: faultDetail: {}string:return code: 404 <html><head><title>Site Not Found</title></head&= gt; <body>No web site is configured at this address.</body></htm= l> {http://xml.apache.org/axis/}HttpErrorCode:404 (404)Object Not Found at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBu= ilder.java:221) at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBui= lder.java:128) at org.apache.axis.encoding.DeserializationContext.endElement(Deser= ializationConte xt.java:1077) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(U= nknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentCo= ntentDispatcher .dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocume= nt(Unknown Sour ce) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Sourc= e) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Sourc= e) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source= ) at javax.xml.parsers.SAXParser.parse(Unknown Source) at org.apache.axis.encoding.DeserializationContext.parse(Deserializ= ationContext.ja va:225) at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:645) at org.apache.axis.Message.getSOAPEnvelope(Message.java:424) at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustU= nderstandChecke r.java:62) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:173) at org.apache.axis.client.Call.invokeEngine(Call.java:2737) at org.apache.axis.client.Call.invoke(Call.java:2720) at org.apache.axis.client.Call.invoke(Call.java:2396) at org.apache.axis.client.Call.invoke(Call.java:2319) at org.apache.axis.client.Call.invoke(Call.java:1776) at org.apache.jsp.jsp.admin.ServiceDetail_jsp.invokeXigniteService(= ServiceDetail_j sp.java:340) at org.apache.jsp.jsp.admin.ServiceDetail_jsp._jspService(ServiceDe= tail_jsp.java:5 02) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:9= 4) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWr= apper.java:298) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.j= ava:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236= ) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter= (ApplicationFil terChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applica= tionFilterChain .java:157) at org.apache.catalina.core.ApplicationDispatcher.invoke(Applicatio= nDispatcher.jav a:703) at org.apache.catalina.core.ApplicationDispatcher.doInclude(Applica= tionDispatcher. java:589) at org.apache.catalina.core.ApplicationDispatcher.include(Applicati= onDispatcher.ja va:499) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLi= brary.java:966) at org.apache.jasper.runtime.PageContextImpl.include(PageContextImp= l.java:581) at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.ja= va:137) at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177) at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.jav= a:756) at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(= InsertTag.java: 881) at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java= :473) at=20 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:9= 4) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWr= apper.java:298) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.j= ava:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236= ) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter= (ApplicationFil terChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applica= tionFilterChain .java:157) at org.apache.catalina.core.ApplicationDispatcher.invoke(Applicatio= nDispatcher.jav a:703) at org.apache.catalina.core.ApplicationDispatcher.processRequest(Ap= plicationDispat cher.java:463) at org.apache.catalina.core.ApplicationDispatcher.doForward(Applica= tionDispatcher. java:398) at org.apache.catalina.core.ApplicationDispatcher.forward(Applicati= onDispatcher.ja va:312) at org.apache.struts.action.RequestProcessor.doForward(RequestProce= ssor.java:1069) at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesReq= uestProcessor.j ava:274) at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefini= tion(TilesReque stProcessor.java:254) at org.apache.struts.tiles.TilesRequestProcessor.processForwardConf= ig(TilesRequest Processor.java:309) at org.apache.struts.action.RequestProcessor.process(RequestProcess= or.java:279) at org.apache.struts.action.ActionServlet.process(ActionServlet.jav= a:1480) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:= 506) at javax.servlet.http.HttpServlet.service(HttpServlet.java:697) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter= (ApplicationFil terChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applica= tionFilterChain .java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWra= pperValve.java: 214) at org.apache.catalina.core.StandardValveContext.invokeNext(Standar= dValveContext.j ava:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipelin= e.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(Sta= ndardContextVal ve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardCon= textValve.java: 152) at org.apache.catalina.core.StandardValveContext.invokeNext(Standar= dValveContext.j ava:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipelin= e.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostVa= lve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(Standar= dValveContext.j ava:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportVa= lve.java:117) at org.apache.catalina.core.StandardValveContext.invokeNext(Standar= dValveContext.j ava:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipelin= e.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngi= neValve.java:10 9) at org.apache.catalina.core.StandardValveContext.invokeNext(Standar= dValveContext.j ava:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipelin= e.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java= :929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.ja= va:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor= .java:793) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.= processConnecti on(Http11Protocol.java:702) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint= .java:571) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Th= readPool.java:6 44) at java.lang.Thread.run(Thread.java:536) ***************************************************************************= ************* ProxyService.java ***************************************************************************= ************* /* * Copyright 2001-2004 The Apache Software Foundation. * * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * 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. */ import org.apache.axis.AxisFault; import org.apache.axis.Message; import org.apache.axis.MessageContext; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.axis.message.SOAPEnvelope; import org.apache.axis.transport.http.HTTPConstants; import javax.servlet.http.HttpServletRequest; import javax.xml.soap.SOAPMessage; import java.net.URL; public class ProxyService { /** * Process the given message, treating it as raw XML. */ public void proxyService(SOAPEnvelope env1, SOAPEnvelope env2) throws AxisFault { try { // Get the current Message Context MessageContext context =3D MessageContext.getCurrentContext(); System.out.println("##### Printing Request Message...."); SOAPMessage message =3D context.getMessage(); message.writeTo(System.out); HttpServletRequest servletRequest =3D (HttpServletRequest) context.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST); System.out.println("##### Request URL: " + servletRequest.getRequestURL()); Service service =3D new Service(); Call call =3D (Call) service.createCall(); // NOW set the client's URL call.setTargetEndpointAddress(new URL("http://www.xignite.com/xInsider.asmx?WSDL")); call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true= )); call.setProperty(Call.SOAPACTION_URI_PROPERTY, "http://www.xignite.com/services/GetOfficers"); call.setRequestMessage((Message) message); call.invoke(); Message responseMessage =3D call.getResponseMessage(); System.out.println("##### Printing Response Message...."); responseMessage.writeTo(System.out); context.setResponseMessage(responseMessage); } catch (Exception exp) { throw AxisFault.makeFault(exp); } } } ***************************************************************************= ************* Client code ***************************************************************************= ************* // this method can be called from any program public static String invokeXigniteService(String requestStr) throws Exception { System.setProperty("javax.xml.soap.MessageFactory", "org.apache.axis.soap.MessageFactoryImpl"); System.setProperty("javax.xml.soap.SOAPConnectionFactory", "org.apache.axis.soap.SOAPConnectionFactoryImpl"); // create service factory ServiceFactory factory =3D ServiceFactory.newInstance(); // define qnames String targetNamespace =3D "http://www.xignite.com/services/"; String schemaNamespace =3D "http://www.xignite.com/services/"; QName serviceName =3D new QName(targetNamespace, "XigniteInsider"); QName portName =3D new QName(targetNamespace, "XigniteInsiderSoap")= ; QName operationName =3D new QName(schemaNamespace, "GetOfficers"); // create service Service service =3D new Service(); Call call =3D (Call) service.createCall(); // set port and operation name call.setPortTypeName(portName); call.setOperationName(operationName); QName strQName =3D new QName("http://www.w3.org/2001/XMLSchema", "string"); QName intQName =3D new QName("http://www.w3.org/2001/XMLSchema", "= int"); QName boolQName =3D new QName("http://www.w3.org/2001/XMLSchema", "boolean"); call.addParameter("IssuerIdentifier", strQName, ParameterMode.IN); call.addParameter("IssuerIdentifierType", strQName, ParameterMode.I= N); // return type =09=09=09//call.setReturnType(org.apache.axis.Constants.XSD_STRING); =09=09=09call.setReturnType(new QName(targetNamespace, "Roster"), Roster.cl= ass); =09=09=09call.setReturnQName(new QName("", "GetOfficersResult")); =09=09=09 =09=09=09// register type mapping =09=09=09call.registerTypeMapping(Roster.class, new QName(targetNamespace, "Roster"), BeanSerializerFactory.class, BeanDeserializerFactory.class); =09=09=09call.registerTypeMapping(Address.class, new QName(targetNamespace, "Address"), BeanSerializerFactory.class, BeanDeserializerFactory.class); =09=09=09call.registerTypeMapping(Security.class, new QName(targetNamespace= , "Security"), BeanSerializerFactory.class, BeanDeserializerFactory.class); =09=09=09call.registerTypeMapping(OutcomeTypes.class, new QName(targetNamespace, "OutcomeTypes"), BeanSerializerFactory.class, BeanDeserializerFactory.class); =09=09=09call.registerTypeMapping(Role.class, new QName(targetNamespace, "Role"), BeanSerializerFactory.class, BeanDeserializerFactory.class); =09=09=09call.registerTypeMapping(Common.class, new QName(targetNamespace, "Common"), BeanSerializerFactory.class, BeanDeserializerFactory.class); =09=09=09call.registerTypeMapping(Role[].class, new QName(targetNamespace, "ArrayOfRole"), ArraySerializerFactory.class, ArrayDeserializerFactory.class); =09=09=09 =09// set end point address call.setTargetEndpointAddress("http://localhost:8080/axis/services/= ProxyService"); =09 //call.setTargetEndpointAddress("http://www.xignite.com/xInsider.asmx"= ); call.setProperty(call.SOAPACTION_USE_PROPERTY, new Boolean(true)); call.setProperty(call.SOAPACTION_URI_PROPERTY, "http://www.xignite.com/services/GetOfficers"); =09=09=09// execute // Invoke the WebService Roster result =3D (Roster) call.invoke(new Object[]{"IBM", "Symbol"= }); =09=09=09=09System.out.println("Search Query: " + requestStr); String resultStr =3D result.toString(); =09 System.out.println(resultStr); =09 return resultStr; }