problem on handling array
皆さん こんにちは。はじめまして、Tiffanyです。 AxisRC3から使い始めて、今週Axis1.2Finalにバージョンアップしました。 英語版のバグリスト等で数回似たような問題が取り上げられていますが、 いまだ仕様なのかバグなのかが分からないため、メーリングリストに 投稿させていただきました。 下記と似たような問題だと思います。 http://issues.apache.org/jira/browse/AXIS-1569 私のプログラムは、 サーバー側のあるクラスの中に配列を持たせて、 クライアントに配列の値を表示する、ごくシンプルなものです。 配列には5つ値をいれているにも関わらず、クライアント側には 最後の1つの値しか返りません。 なお、上記リンクを参考にしてsetter/getterをつけたところ、RC3では動いたものの、 1.2FinalではSAXParseExceptionが発生しました。(これはまた別件になります。。。) どなたか同じような問題に遭遇した方はいらっしゃいますでしょうか? 下記にソースコードを添付しますので、ご確認、ご意見をいただければと思います。 よろしくお願いいたします。 ■サーバーサイド(Tomcat) mysamplesのパッケージにSample01.javaとSample01Rep.javaの 2つのクラスを作りました。 ***Sample01.java*** package mysamples; import java.io.Serializable; public class Sample01 implements Serializable{ public Sample01Rep returnArray(){ return new Sample01Rep(); } } ***Sample01.java*** package mysamples; import java.io.Serializable; public class Sample01Rep implements Serializable{ public String[] name = {name1, name2, name3, name4 , name5}; public Sample01Rep(){ } } ■クライアントサイド(Java) ***Sample01Client.java*** import mysamples.Sample01; import mysamples.Sample01Rep; import mysamples.Sample01Service; import mysamples.Sample01ServiceLocator; public class Sample01Client{ public static void main(String[] args) throws Exception{ System.out.println( Sample01 Client ); //Make a Service Sample01Service service = new Sample01ServiceLocator(); //Now use the service to get a stub Sample01 stub = service.getsample01(); //Make the actual call Sample01Rep rep = stub.returnArray(); System.out.println(length -- + rep.getName().length); for(int i=0; irep.getName().length; i++){ System.out.println([ + rep.getName()[i] + ]); } System.out.println( END ); } } ■結果 Sample01 Client length -- 1 [name5] END なお、想定される結果は下記に示している感じです。 Sample01 Client length -- 5 [name1] [name2] [name3] [name4] [name5] END ■その他 ○JAVA2WSDL (host:portは省かせていただきました。) java org.apache.axis.wsdl.Java2WSDL -o Sample01.wsdl -lhttp://host:port/axis/services/sample01 -n sample01 mysamples.Sample01 ○WSDL2JAVA java org.apache.axis.wsdl.WSDL2Java Sample01.wsdl -s -o ClientSample -p mysamples ○WSDD 生成されたdeploy.wsddファイル内のクラス名部分を下記のように変更しました。 (変更前) parameter name=className value=mysamples.Sample01SoapBindingImpl/ (変更後) parameter name=className value=mysamples.Sample01/ ○デプロイ(host:portは省かせていただきました。) java org.apache.axis.client.AdminClient -lhttp://host:port/axis/servlet/AxisServlet deploy.wsdd 以上です。 - Tiffany Chan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Axis Client ISA Proxy server
Marco, search the archive of this mailing list ... I myself asked this question in the past but couldn't find my email. There's some support in the JDK starting with 1.4.2 .. I guess your problem is the domain for your proxy authorisation ... There's a new property, what was it, aehm, proxyDomain or proxyNTLM or so ... Merten -Original Message- From: Marco Rossi [mailto:[EMAIL PROTECTED] Sent: Friday, May 13, 2005 9:08 AM To: axis-user@ws.apache.org Subject: Axis Client ISA Proxy server Hi, I have to create a axis client to contact a web service behind a ISA proxy, with the NTLM authentication (unfortunatly i can't change this configuration!). I tried with axis 1.2, and with the following configuration: in the client-config.wsdd with the row: transport name=http pivot=java:org.apache.axis.transport.http.CommonsHTTPSender / in the client code: System.setProperty(http.proxyHost,myProxy); System.setProperty(http.proxyPort,proxyPort); System.setProperty(http.proxyUser,NTDomain\\username); System.setProperty(http.proxyPassword,password); String url_address = https://myServer/test/;; URL endpoint = new URL(url_address); MyWsSoap ws = locator.getMyWsSoap(endpoint); ... .. It does't work. Any suggestion. Where can i find a library or a sample code to use axis with a NTLM authentication system? Thanks in advance, Marco
RE: Axis Client ISA Proxy server
hm, no idea what this error means regarding the proxy stuff: IMHO if you do specify http.auth.ntlm.domain the proxyUser should be user and not domain\\user ... -Original Message- From: Marco Rossi [mailto:[EMAIL PROTECTED] Sent: Friday, May 13, 2005 9:38 AM To: axis-user@ws.apache.org Subject: Re: Axis Client ISA Proxy server Hi Merten , i tried with a jdk 1.5, with the following System.setProperty(http.proxyHost,proxy); System.setProperty(http.proxyPort,port); System.setProperty(http.proxyUser,domain\\user); System.setProperty(http.proxyPassword,passwd); System.setProperty(http.auth.ntlm.domain,domain); and i have the following error (without client-config.wsdd in classpath) ... javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? or java.lang.IllegalArgumentException: host parameter is null (with client-config.wsdd in classpath) On 5/13/05, Merten Schumann [EMAIL PROTECTED] wrote: Marco, search the archive of this mailing list ... I myself asked this question in the past but couldn't find my email. There's some support in the JDK starting with 1.4.2 .. I guess your problem is the domain for your proxy authorisation ... There's a new property, what was it, aehm, proxyDomain or proxyNTLM or so ... Merten -Original Message- From: Marco Rossi [mailto:[EMAIL PROTECTED] Sent: Friday, May 13, 2005 9:08 AM To: axis-user@ws.apache.org Subject: Axis Client ISA Proxy server Hi, I have to create a axis client to contact a web service behind a ISA proxy, with the NTLM authentication (unfortunatly i can't change this configuration!). I tried with axis 1.2, and with the following configuration: in the client-config.wsdd with the row: transport name=http pivot=java:org.apache.axis.transport.http.CommonsHTTPSender / in the client code: System.setProperty(http.proxyHost,myProxy); System.setProperty(http.proxyPort,proxyPort); System.setProperty(http.proxyUser,NTDomain\\username); System.setProperty(http.proxyPassword,password); String url_address = https://myServer/test/;; URL endpoint = new URL(url_address); MyWsSoap ws = locator.getMyWsSoap(endpoint); ... .. It does't work. Any suggestion. Where can i find a library or a sample code to use axis with a NTLM authentication system? Thanks in advance, Marco
Handlers and Chains (server-side)
Dear All Has anyone experience of the above? Is what i'm trying to do possible? I'm trying to add the request soap to the response soap (server-side) I then want to use the repsone soap (which now becomes the request soap) in other methods called by a 'client' Has anyone experience of this ? Many thanks for any help _ Want to block unwanted pop-ups? Download the free MSN Toolbar now! http://toolbar.msn.co.uk/
Re: DocumentBuilder from byte/packet
Any drawbacks on using input streams? DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); { String xml = ?xml version=\1.0\?foo/foo; StringReader reader = new StringReader(xml); InputSource source = new InputSource(reader); Document doc = db.parse(source); System.out.println(doc.getChildNodes().item(0)); } { byte[] xml = ?xml version=\1.0\?bar/bar.getBytes(); InputStream inputstream = new ByteArrayInputStream(xml); Document doc = db.parse(inputstream); System.out.println(doc.getChildNodes().item(0)); } Frank schrieb: Was tring to figure out the best way to take an XML document that I have read in from a datagram socket stored in a DatagramPacket(can convert to byte or String etc) to be able to parse it using DocumentBuilder using a DOM parse. All the methods seem to work off of a file or a steam. any thoughts? Thanks, Frank
Re: DocumentBuilder from byte/packet
No I think that will work just fine. Thank you. Frank Mike Haller wrote: Any drawbacks on using input streams? DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); { String xml = ?xml version=\1.0\?foo/foo; StringReader reader = new StringReader(xml); InputSource source = new InputSource(reader); Document doc = db.parse(source); System.out.println(doc.getChildNodes().item(0)); } { byte[] xml = ?xml version=\1.0\?bar/bar.getBytes(); InputStream inputstream = new ByteArrayInputStream(xml); Document doc = db.parse(inputstream); System.out.println(doc.getChildNodes().item(0)); } Frank schrieb: Was tring to figure out the best way to take an XML document that I have read in from a datagram socket stored in a DatagramPacket(can convert to byte or String etc) to be able to parse it using DocumentBuilder using a DOM parse. All the methods seem to work off of a file or a steam. any thoughts? Thanks, Frank
Re: config files
I think u have to put the configuration files under ur-web-app-root-dir\WEB-INF\classes dir. On 5/13/05, Nguyen Tuan Anh [EMAIL PROTECTED] wrote: Hi, I need to deploy a web service, but it needs to read some configuration files. I read from the log file that I did not find the config files. Could anyone tell me where can I put the config files for my service. Thanks, tuan anh
RE: problem integrating the client in another web application: AxisServlet threw exception
Michael, Thanks for your reply. I just started calling the web service in the .jsp file. Here is my client code from .jsp file: % String endpoint = http://localhost:8080/bserv/services/EmployeeDataService; String[] args = {getEmployeeLateTSDataArray, 22624, 8524}; String method = args[0]; String arg1 = args[1];; String arg2 = args[2];; Service service = new Service(); Call call = null; QName qname = null; Class cls = null; qname = new QName(EmployeeLateTSArray, EmployeeLateTSBean); TypeMappingRegistry tmr = service.getTypeMappingRegistry(); TypeMapping tmlts = tmr.createTypeMapping(); try { tmlts.register( Class.forName(com.bbn.ws.EmployeeLateTSBean), qname, new org.apache.axis.encoding.ser.BeanSerializerFactory(EmployeeLateTSBean.class,qname), new org.apache.axis.encoding.ser.BeanDeserializerFactory(EmployeeLateTSBean.class,qname)); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } tmr.register(http://schemas.xmlsoap.org/soap/encoding/, tmlts); qname = new QName(EmployeeLateTSArray, EmployeeLateTSBeanArray); call = (Call) service.createCall(); call.setReturnType (qname); try { call.setTargetEndpointAddress(new java.net.URL(endpoint)); } catch (MalformedURLException e2) { e2.printStackTrace(); } call.setOperationName(method); call.addParameter(admnum, XMLType.XSD_INTEGER, ParameterMode.IN); call.addParameter(mgrnum, XMLType.XSD_INTEGER, ParameterMode.IN); call.setReturnType(qname); System.out.println(Called method: + method + ( + arg1 + , + arg2 + )); EmployeeLateTSBean e[] = (EmployeeLateTSBean[])call.invoke(new Object[] { new Integer(arg1), new Integer(arg2) }); % %= e[0].toString(); % I will look into using HttpClient as you suggested. Thanks again, Sri At 05:47 PM 5/12/2005, Michael Oliver wrote: Sri, Its hard to tell what you are doing because we don't see any of the source, but I can tell you that I use commons HttpClient to access one servlet from another servlet all day long with no problems so you can at least know that should work. Michael Oliver CTO Alarius Systems LLC 6800 E. Lake Mead Blvd, #1096 Las Vegas, NV 89156 Phone:(702)643-7425 Fax:(702)974-0341 *Note new email changed from [EMAIL PROTECTED] -Original Message- From: Srinadh Karumuri [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 12, 2005 1:11 PM To: axis-user@ws.apache.org Subject: problem integrating the client in another web application: AxisServlet threw exception Well, Now it's scary. I wrote test client code and my services work quite well. Now I am trying to call these services from my web application which is residing on the same Tomcat and getting the following exception. Can anyone direct/guide me? If this doesn't work then I will have to dump the Axis altogether and go to plan B which I am reluctant to do. Thanks for any help, -Sri 2005-05-12 15:42:28 StandardWrapperValve[AxisServlet]: Servlet.service() for servlet AxisServlet threw exception javax.servlet.ServletException: Servlet execution threw an exception at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:222) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:146) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:209) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:596) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 33) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:144) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:596) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 33) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:235 8) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :133) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:596) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa lve.java:118) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:594) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :116) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:594) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 33) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. java:127) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:596) at
RE: Problem calling Axis WS from .Net
Thanks for looking into this for me Anne. As always really appreciate your help. We're using Microsoft .Net Framework 1.1 (version 1.1.4322 SP1) -Original Message- From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: Friday, May 13, 2005 10:13a To: axis-user@ws.apache.org; [EMAIL PROTECTED] Subject: Re: Problem calling Axis WS from .Net What version of .NET are you using? At one point .NET had trouble dealing with imported schemas. On 5/12/05, Eugene Shershnev [EMAIL PROTECTED] wrote: OK, I found a way to make .Net to understand the response. If I put all type definitions under one schema everything works. Does anybody have a clue what's wrong with multiple schema definitions? Thanks, Eugene _ From: Eugene Shershnev [mailto:[EMAIL PROTECTED] Sent: Thursday, May 12, 2005 11:49a To: 'axis-user@ws.apache.org' Subject:Problem calling Axis WS from .Net Hi All, We're having problem between .Net client (C#) and Axis service. Axis version is 1.2 The WSDL defined 2 operations: login and logout. Login returns LoginResult object that contains 3 strings - that simple. The WSDL is attached. File: MyWSDL.wsdl In the server-config.wsdd the service is defined like this: service name=MyService provider=java:RPC style=wrapped use=literal wsdlFileMyWSDL.wsdl/wsdlFile parameter name=allowedMethods value=*/ parameter name=className value=mydomain.myservice.MyWebService/ parameter name=sendXsiTypes value=false/ parameter name=sendMultiRefs value=false/ beanMapping languageSpecificType=java:mydomain.myservice.LoginResult qname=ns1:LoginResult xmlns:ns1=urn:type.myservice.mydomain/ beanMapping languageSpecificType=java:mydomain.myservice.UnexpectedErrorFault qname=ns2:UnexpectedErrorFault xmlns:ns2=urn:fault.myservice.mydomain/ namespaceurn:myservice.mydomain/namespace /service And the response looks like this: ?xml version=1.0 encoding=utf-8? soapenv:Envelope xmlns: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:Body loginResponse xmlns=urn:myservice.mydomain loginReturn hostSiteIDMySite1/hostSiteID sessionIDEXPIRES:20050513111757-0400 UID:domain\uid/sessionID sessionTimeout600/sessionTimeout /loginReturn /loginResponse /soaenv:Body /soapenv:Envelope Now here is the problem - when .Net client calls login() it get LoginResult object back, but all its elements are null. Any help and pointers will be highly appreciated! -- Eugene
Unable to tcpmon remote web services
Hi All, I want to monitor a third party remote web service whose endpoint url in the wsdl is http://167.454.48.33/service/update.asmx I have changed the above url to http://localhost:88/service/update.asmx and started tcpmon of AXIS 1.2 RC2 with below settings : Listen Port: 88 Host: 167.454.48.33 Port: 80 and ofcourse set below properties in my client program before running it since I am behind a firewall System.setProperty(http.proxyHost, my proxy ip goes here); System.setProperty(http.proxyPort, my proxy port goes here); and when I run my client program I am getting an exception 403 forbidden . I am getting valid response from service when I dont use TCPMON but I want to use TCPMON to see how the response from server looks like. Can anybody please tell why tcpmon is behaving weirdly (?) or what am I missing. Even I tried to start tcpmon with proxy settings configured inside it but no avail. Thanks Regards, Kumar.
Re: Session not set in generated code
Hi Peter, you could try the following in your client: SomeServiceLocator someLocator = new SomeServiceLocator(); // ant generated SomeSoapBindingStub someStub = null; // ant generated try { someStub = SomeSoapBindingStub someLocator.getSomeService(); // get the service someStub._getCall().setMaintainSession(true); // enable sessions someStub.someMethod(); // call one of your service's methods ... } ... Hope this helps, Regards, Tom Peter Bosmans wrote: Hi, In my build.xml file, to generate client-side java code, i specify that the client must work in a session scope. target name=wsdl2java_client echo message=Running WSDL2Java Client Emitters/ !-- NdsAdmin WSDL to Java for server -- axis-wsdl2java url=src/NdsAdmin.wsdl output=${project.home.client}/src deployscope=session serverSide=no skeletonDeploy=no noimports=no verbose=no testcase=no /axis-wsdl2java /target When i run the client, it will not work in session scope. Therefore i must add the following line in the generated Service source. _call.setMaintainSession(true); But i don't want to add or change stuff in generated code. Is there an other way to set the maintainsession ? Peter
Enumeration help
Hi,I have been looking through the mail list archive for an answer to this but could find an answer. I have a enumeration in java which I want to send via soap (see below) I have tried various things to do this but I have come up against probs for each one.First I tried to write my own custon serializer (see below) the SerializerFactory instance was always lost in the typeMappings internally and defaulted back to a bean mapping.Next I decided to try and use the EnumSerializer so change my class, which almost worked but this require the type of fields that define the values to be strings (whereas mine are instance of the class).Has anyone got any advice about which way to go? Cheers Mike8 This is my class that I modified for the EnumSerializer...public class WorkHomeimplements Serializable { protected static final Map INSTANCES = new HashMap();public static final WorkHome WORK = new WorkHome(Work); public static final WorkHome HOME = new WorkHome(Home);static {INSTANCES.put(WORK.toString(), WORK);INSTANCES.put(HOME.toString(), HOME);}private String name; private WorkHome(String name) { ... }protected Object readResolve() { ...}public static Object getInstance(String name) { ...}public String getValue() { ... }public static Object fromValue(String value) { ... } public static Object fromString(String value) { ... }}}Here are my attempts at my own serializer and deserialiserpublic class EnumSer extends SimpleSerializer {public EnumSer(Class javaType, QName xmlType) { super(javaType, xmlType);} public void serialize(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException {context.startElement(name, attributes);context.writeString(getValueAsString(value, context));context.endElement();} public String getValueAsString(Object arg0, SerializationContext arg1) { // call to string} public Element writeSchema(Class javaType, Types types) throws Exception { return writeEnumType(xmlType, javaType, types);} public Element writeEnumType(QName qName, Class cls, Types types) throws NoSuchMethodException, IllegalAccessException, AxisFault { Class base = cls; // Create simpleType, restriction elementsElement simpleType = types.createElement(simpleType); simpleType.setAttribute(name, cls.getName()); Element restriction = types.createElement(restriction); simpleType.appendChild(restriction); String baseType = types.writeType(base, null); restriction.setAttribute(base, baseType); // Create an enumeration using the field values Field[] fields = cls.getDeclaredFields();for (int i = 0; i fields.length; i++) {Field field = fields[i];int mod = field.getModifiers();// Inspect each public static final field of the same type// as the baseif (Modifier.isPublic(mod) Modifier.isStatic(mod) Modifier.isFinal(mod) (field.getType() == base)) {// Create an enumeration using the value specifiedElement enumeration = types.createElement(enumeration);enumeration.setAttribute(value, field.get(null).toString());restriction.appendChild(enumeration);}}return simpleType;} } public class EnumDeSer extends SimpleDeserializer { private Method getInstanceMethod = null; private static final Class[] STRING_CLASS = new Class[] { java.lang.String.class }; public EnumDeSer(Class arg0, QName arg1) { super(arg0, arg1); } public Object makeValue(String source) throws Exception { // Invoke the fromString static method to get the Enumeration value if (isNil) return null; if (getInstanceMethod == null) { try { getInstanceMethod = MethodCache.getInstance().getMethod( javaType, getInstance, STRING_CLASS); } catch (Exception e) { throw new IntrospectionException(e.toString()); } } return getInstanceMethod.invoke(null, new Object[] { source }); } } the factories are exactly the same as the normal one (just with the serializer class changed)
Re: Unable to tcpmon remote web services
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Friday 13 May 2005 17:08, Yen wrote: and ofcourse set below properties in my client program before running it since I am behind a firewall I think proxy configuration must be setted in tcpmon dialog. Ilias - -- /** * Reply to: ilias.bartolini(at)studio.unibo.it * ICQ# 42797710 - FeSToso n°143 - PGP Key-IDs:0x6A951A45 * http://www.brainetwork.net/homepage - https://www.universibo.unibo.it * http://www.icalx.com/html/brain79/week.php?cal=brain79.public */ -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFChMcg+CP4pmqVGkURAroQAJ9L8Jm6l4XPwIRhEutpJaYX90D4LACeIje9 snc0lguWJSfWtpBxC4XDbIQ= =8XcM -END PGP SIGNATURE-
soap request shows password
Hi all I'm calling a method from a web service and watching the soap being sent back and forth. I'm passing through a password and noticed it's showing in the soap request Am i able to stop this info from being shown? Mant thanks for your help Will someone be able to 'sniff' this info? Or am i bing over cautious? soapenv:Envelope xmlns: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:Body getUserNamePassword soapenv:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/; arg0 xsi:type=xsd:stringtest/arg0 arg1 xsi:type=xsd:stringpassword/arg1 /getUserNamePassword /soapenv:Body /soapenv:Envelope _ Use MSN Messenger to send music and pics to your friends http://messenger.msn.co.uk
Axis newbie, .NET idiot; add web reference of wsdl file generating errors? SOAP header params how-to?
I have two questions that I hope y'all can help me with. Here's a little background on why I'm bothering y'all. We've got a bunch of java interfaces being used via RMI, now we want to expose them via web services, too. We do our own authentication, so I was thinking the easiest thing is to have the client call the authentication method, and then pass the resulting authentication token as a header arg-that way the existing java interfaces don't need to change. Question 1) I'm also not such a smartie about wsdl. (I'm sure you're wondering if I'm a smartie about anything ;-) ) The WSDL for my service is below. It works just fine with WSDL2Java, and the generated Java client stubs do just what I want them to. However, when I Add Web Reference in .NET, it gives an error, the element attribute is not allowed on encoded message parts. If I change the part specification from wsdl:part element=intf:authToken name=auth_header/ to wsdl:part type=intf:authToken name=auth_header/, it says The datatype 'authToken' is missing., and WSDL2Java says the same thing. If I undo that change and change the operation to be literal, then it says that The combination of style=rpc with use=literal is not supported. If I change it to style=document, it says Unable to import operation 'getExchangeRate'. Specified cast is not valid. Would someone take pity on the noob and help me with my WSDL? Question 2) I know virtually nothing about c#, but someone gave me a test program that calls a web service. I was able to figure out how to add my web service to the environment, and add a call to it from the little program, but what do I do about header args? Could someone help me figure how to pass a SOAP header argument on the call? Or will this problem be magically solved once I can successfully import the web service? Here's the code I have: FirstSOAPTest.CurrencyService.CurrencyWebServiceService curServ = new FirstSOAPTest.CurrencyService.CurrencyWebServiceService(); // The value of a proper authToken is in this.textBoxAuthReturn.Text double s = curServ.getExchangeRate(); The WSDL is what was generated by Axis, and then I added the bits about a header arg (the parts I added are surrounded by blank lines). Here's my WSDL: ?xml version=1.0 encoding=UTF-8? wsdl:definitions targetNamespace=http://localhost:8080/avalanche/services/currency; xmlns:impl=http://localhost:8080/avalanche/services/currency; xmlns:intf=http://localhost:8080/avalanche/services/currency; xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:wsdlsoap=http://schemas.xmlsoap.org/wsdl/soap/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; !-- added by me -- wsdl:types xsd:schema targetNamespace=http://localhost:8080/avalanche/services/currency; xmlns:SOAP-ENC=http://schemas.xmlsoap.org/soap/encoding/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsd1=http://localhost:8080/avalanche/services/.xsd1; xsd:element name=authToken xsd:complexType xsd:all xsd:element maxOccurs=1 minOccurs=1 name=value type=xsd:string/ /xsd:all /xsd:complexType /xsd:element /xsd:schema /wsdl:types !-- end addition -- !-- added by me -- wsdl:message name=getExchangeRateRequest wsdl:part type=intf:authToken name=auth_header/ /wsdl:message !-- end addition -- wsdl:message name=getExchangeRateResponse wsdl:part name=getExchangeRateReturn type=xsd:double/ /wsdl:message wsdl:portType name=CurrencyWebService wsdl:operation name=getExchangeRate wsdl:input message=impl:getExchangeRateRequest name=getExchangeRateRequest/ wsdl:output message=impl:getExchangeRateResponse name=getExchangeRateResponse/ /wsdl:operation /wsdl:portType wsdl:binding name=currencySoapBinding type=impl:CurrencyWebService wsdlsoap:binding style=rpc transport=http://schemas.xmlsoap.org/soap/http/ !-- added by me -- wsdl:operation name=getExchangeRate wsdlsoap:operation soapAction=/ wsdl:input name=getExchangeRateRequest wsdlsoap:body encodingStyle=http://schemas.xmlsoap.org/soap/encoding/; namespace=http://currency.examples.ecm.opentext.com; use=encoded/ wsdlsoap:header encodingStyle=http://schemas.xmlsoap.org/soap/encoding/; message=impl:getExchangeRateRequest part=auth_header use=encoded/ /wsdl:input wsdl:output name=getExchangeRateResponse wsdlsoap:body encodingStyle=http://schemas.xmlsoap.org/soap/encoding/;
Re: soap request shows password
Hi, no, you are not too cautious. All the information you send to/from your web service can be intercepted and read since it's xml / plain text. To solve this problem you have to use SSL. This article (which I was just looking at 3 minutes ago) shows you how to do it: http://www.samspublishing.com/articles/article.asp?p=24604 Regards, Tom Plorks mail wrote: Hi all I'm calling a method from a web service and watching the soap being sent back and forth. I'm passing through a password and noticed it's showing in the soap request Am i able to stop this info from being shown? Mant thanks for your help Will someone be able to 'sniff' this info? Or am i bing over cautious? soapenv:Envelope xmlns: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:Body getUserNamePassword soapenv:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/; arg0 xsi:type=xsd:stringtest/arg0 arg1 xsi:type=xsd:stringpassword/arg1 /getUserNamePassword /soapenv:Body /soapenv:Envelope _ Use MSN Messenger to send music and pics to your friends http://messenger.msn.co.uk
RE: SAXException - Invalid element error
Unfortunately, I did not run with debug mode or have any monitor, so I do not have the complete SOAP xml packet. This problem has come a few times, and I have not been able to reliably reproduce it. I suspect that depending upon data, this happens. However here is the wsdl, and the piece of Java code that is giving this error. The java code is trying to retrieve an array of DeviceDetail objects, and gets the exception below: code that is encountering the exception com.cisco.nm.wlse.xmlapi.inventory.gencode.Device[] wlseAPDevs = null; try { String[] apDeviceTypes = APDeviceTypeInfo.getSupportedDeviceTypes(); String[] deviceStates = new String[] {m}; wlseAPDevs = invHandle.getDevicesEx(apDeviceTypes, deviceStates, 0); } catch (java.rmi.RemoteException re) { String errorStr = WLSE + wd.getAddressableIp() + is not responding for getDevicesEx(); _Mlogger.error(errorStr); throw new WlsessException(WLSE_NOT_RESPONDING, errorStr); } if (wlseAPDevs == null || wlseAPDevs.length == 0) { _Mlogger.warn(no AP information in the WLSE with IP: + wd.getAddressableIp()); return; } // get AP details. DeviceDetail[] apDetails = null; com.cisco.nm.wlse.xmlapi.DeviceId[] apIDs = new com.cisco.nm.wlse.xmlapi.DeviceId[wlseAPDevs.length]; for (int j = 0; j wlseAPDevs.length; j++) { apIDs[j] = wlseAPDevs[j].getId(); } try { // get all devices in one shot - // if slow, may have to put this in a loop. apDetails = invHandle.getDeviceDetail(apIDs); } catch (java.rmi.RemoteException re) { -- here is the exception that is being caught and logged _Mlogger.error(WLSE + wd.getAddressableIp() + is not responding for getDeviceDetail()); throw new WlsessException(WLSE_NOT_RESPONDING, No Response from WLSE for Inventory.getDeviceDetail()); } === The generated wsdl (inventory.wsdl): ?xml version=1.0 encoding=UTF-8? wsdl:definitions targetNamespace=urn:com.cisco.nm.wlse.xmlapi.inventory xmlns=http://schemas.xmlsoap.org/wsdl/; xmlns:apachesoap=http://xml.apache.org/xml-soap; xmlns:impl=urn:com.cisco.nm.wlse.xmlapi.inventory xmlns:intf=urn:com.cisco.nm.wlse.xmlapi.inventory xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; xmlns:tns1=urn:com.cisco.nm.wlse.xmlapi xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:wsdlsoap=http://schemas.xmlsoap.org/wsdl/soap/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; wsdl:types schema targetNamespace=urn:com.cisco.nm.wlse.xmlapi.inventory xmlns=http://www.w3.org/2001/XMLSchema; import namespace=http://schemas.xmlsoap.org/soap/encoding// complexType name=Device sequence element name=id nillable=true type=tns1:DeviceId/ element name=ipAddress nillable=true type=xsd:string/ element name=hostname nillable=true type=xsd:string/ element name=product nillable=true type=xsd:string/ element name=version nillable=true type=xsd:string/ element name=deviceType nillable=true type=xsd:string/ element name=timeLastDiscovered type=xsd:long/ /sequence /complexType complexType name=ArrayOfDevice complexContent restriction base=soapenc:Array attribute ref=soapenc:arrayType wsdl:arrayType=impl:Device[]/ /restriction /complexContent /complexType element name=ArrayOfDevice nillable=true type=impl:ArrayOfDevice/ complexType name=ArrayOf_xsd_string complexContent restriction base=soapenc:Array attribute ref=soapenc:arrayType wsdl:arrayType=xsd:string[]/ /restriction /complexContent /complexType element name=ArrayOf_xsd_string nillable=true type=impl:ArrayOf_xsd_string/ complexType name=TableMetadata sequence element maxOccurs=unbounded name=columns nillable=true type=impl:TableColumn/ /sequence /complexType complexType name=TableColumn sequence element name=name nillable=true type=xsd:string/ element name=type nillable=true type=xsd:string/ /sequence /complexType element name=TableMetadata nillable=true type=impl:TableMetadata/ complexType name=ArrayOf_tns1_DeviceId complexContent restriction base=soapenc:Array attribute ref=soapenc:arrayType wsdl:arrayType=tns1:DeviceId[]/ /restriction /complexContent /complexType element name=ArrayOf_tns1_DeviceId nillable=true type=impl:ArrayOf_tns1_DeviceId/ complexType name=TableData sequence element maxOccurs=unbounded name=rows nillable=true type=impl:TableRow/ element name=fromRowNumber type=xsd:int/ element name=numberOfRows type=xsd:int/ element name=hasMoreRows type=xsd:boolean/ /sequence /complexType complexType name=TableRow sequence
RE: problem integrating the client in another web application: AxisServlet threw exception
Michael, I checked the HttpClient and understood what you meant. So, it should be working with my web app on the same Tomcat. As it shows in the RootCouse: root cause java.lang.LinkageError: loader constraints violated when linking javax/xml/soap/SOAPMessage class at org.apache.axis.client.Call.init(Call.java:263) at org.apache.axis.client.Service.createCall(Service.java:566) I started using a simple JSP page but still my Call.init is failing. -Sri At 10:18 AM 5/13/2005, you wrote: Michael, Thanks for your reply. I just started calling the web service in the .jsp file. Here is my client code from .jsp file: % String endpoint = http://localhost:8080/bserv/services/EmployeeDataService; String[] args = {getEmployeeLateTSDataArray, 22624, 8524}; String method = args[0]; String arg1 = args[1];; String arg2 = args[2];; Service service = new Service(); Call call = null; QName qname = null; Class cls = null; qname = new QName(EmployeeLateTSArray, EmployeeLateTSBean); TypeMappingRegistry tmr = service.getTypeMappingRegistry(); TypeMapping tmlts = tmr.createTypeMapping(); try { tmlts.register( Class.forName(com.bbn.ws.EmployeeLateTSBean), qname, new org.apache.axis.encoding.ser.BeanSerializerFactory(EmployeeLateTSBean.class,qname), new org.apache.axis.encoding.ser.BeanDeserializerFactory(EmployeeLateTSBean.class,qname)); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } tmr.register(http://schemas.xmlsoap.org/soap/encoding/, tmlts); qname = new QName(EmployeeLateTSArray, EmployeeLateTSBeanArray); call = (Call) service.createCall(); call.setReturnType (qname); try { call.setTargetEndpointAddress(new java.net.URL(endpoint)); } catch (MalformedURLException e2) { e2.printStackTrace(); } call.setOperationName(method); call.addParameter(admnum, XMLType.XSD_INTEGER, ParameterMode.IN); call.addParameter(mgrnum, XMLType.XSD_INTEGER, ParameterMode.IN); call.setReturnType(qname); System.out.println(Called method: + method + ( + arg1 + , + arg2 + )); EmployeeLateTSBean e[] = (EmployeeLateTSBean[])call.invoke(new Object[] { new Integer(arg1), new Integer(arg2) }); % %= e[0].toString(); % I will look into using HttpClient as you suggested. Thanks again, Sri At 05:47 PM 5/12/2005, Michael Oliver wrote: Sri, Its hard to tell what you are doing because we don't see any of the source, but I can tell you that I use commons HttpClient to access one servlet from another servlet all day long with no problems so you can at least know that should work. Michael Oliver CTO Alarius Systems LLC 6800 E. Lake Mead Blvd, #1096 Las Vegas, NV 89156 Phone:(702)643-7425 Fax:(702)974-0341 *Note new email changed from [EMAIL PROTECTED]
RE: problem integrating the client in another web application: AxisServlet threw exception
Does any one have a sample code for calling an Axis Web service from a JSP page? Interesting thing is: Same code when I tried on Tomcat 3 gives me the following exception: Internal Servlet Error: java.lang.IllegalStateException: Response has already been committed at java.lang.Throwable.fillInStackTrace(Native Method) at java.lang.Throwable.fillInStackTrace(Compiled Code) at java.lang.Throwable.(Compiled Code) at java.lang.Exception.(Compiled Code) at java.lang.RuntimeException.(Compiled Code) at java.lang.IllegalStateException.(Compiled Code) at org.apache.tomcat.core.HttpServletResponseFacade.sendError(Compiled Code) : : -Sri At 01:05 PM 5/13/2005, you wrote: Michael, I checked the HttpClient and understood what you meant. So, it should be working with my web app on the same Tomcat. As it shows in the RootCouse: root cause java.lang.LinkageError: loader constraints violated when linking javax/xml/soap/SOAPMessage class at org.apache.axis.client.Call.init(Call.java:263) at org.apache.axis.client.Service.createCall(Service.java:566) I started using a simple JSP page but still my Call.init is failing. -Sri At 10:18 AM 5/13/2005, you wrote: Michael, Thanks for your reply. I just started calling the web service in the .jsp file. Here is my client code from .jsp file: % String endpoint = http://localhost:8080/bserv/services/EmployeeDataService; String[] args = {getEmployeeLateTSDataArray, 22624, 8524}; String method = args[0]; String arg1 = args[1];; String arg2 = args[2];; Service service = new Service(); Call call = null; QName qname = null; Class cls = null; qname = new QName(EmployeeLateTSArray, EmployeeLateTSBean); TypeMappingRegistry tmr = service.getTypeMappingRegistry(); TypeMapping tmlts = tmr.createTypeMapping(); try { tmlts.register( Class.forName(com.bbn.ws.EmployeeLateTSBean), qname, new org.apache.axis.encoding.ser.BeanSerializerFactory(EmployeeLateTSBean.class,qname), new org.apache.axis.encoding.ser.BeanDeserializerFactory(EmployeeLateTSBean.class,qname)); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } tmr.register(http://schemas.xmlsoap.org/soap/encoding/, tmlts); qname = new QName(EmployeeLateTSArray, EmployeeLateTSBeanArray); call = (Call) service.createCall(); call.setReturnType (qname); try { call.setTargetEndpointAddress(new java.net.URL(endpoint)); } catch (MalformedURLException e2) { e2.printStackTrace(); } call.setOperationName(method); call.addParameter(admnum, XMLType.XSD_INTEGER, ParameterMode.IN); call.addParameter(mgrnum, XMLType.XSD_INTEGER, ParameterMode.IN); call.setReturnType(qname); System.out.println(Called method: + method + ( + arg1 + , + arg2 + )); EmployeeLateTSBean e[] = (EmployeeLateTSBean[])call.invoke(new Object[] { new Integer(arg1), new Integer(arg2) }); % %= e[0].toString(); % I will look into using HttpClient as you suggested. Thanks again, Sri At 05:47 PM 5/12/2005, Michael Oliver wrote: Sri, Its hard to tell what you are doing because we don't see any of the source, but I can tell you that I use commons HttpClient to access one servlet from another servlet all day long with no problems so you can at least know that should work. Michael Oliver CTO Alarius Systems LLC 6800 E. Lake Mead Blvd, #1096 Las Vegas, NV 89156 Phone:(702)643-7425 Fax:(702)974-0341 *Note new email changed from [EMAIL PROTECTED]
Re: problem integrating the client in another web application: AxisServlet threw exception
I've been working on integrating Axis with Netbeans and I just finished the trivial case of using a JSP to consume a WebService. -- [EMAIL PROTECTED] contentType=text/html% [EMAIL PROTECTED] pageEncoding=UTF-8% [EMAIL PROTECTED] import=play.*% html headtitleJSP Page/title/head body % String val=earnest; try{ HiSEI hiStub = new HiSEIServiceLocator().getHiSEIPort(); out.println(hiStub.sayHi(Allison)); }catch (Exception ex){}% /body /html The import references the package play which was created by wsdl2java and contains the two classes referenced in the scriptlet. dga On 5/13/05, Srinadh Karumuri [EMAIL PROTECTED] wrote: Does any one have a sample code for calling an Axis Web service from a JSP page? Interesting thing is: Same code when I tried on Tomcat 3 gives me the following exception: Internal Servlet Error: java.lang.IllegalStateException: Response has already beencommittedatjava.lang.Throwable.fillInStackTrace(Native Method)atjava.lang.Throwable.fillInStackTrace(Compiled Code) atjava.lang.Throwable.(Compiled Code)atjava.lang.Exception.(Compiled Code)atjava.lang.RuntimeException.(Compiled Code)atjava.lang.IllegalStateException.(Compiled Code) atorg.apache.tomcat.core.HttpServletResponseFacade.sendError(CompiledCode): : -Sri At 01:05 PM 5/13/2005, you wrote: Michael, I checked the HttpClient and understood what you meant. So, it should be working with my web app on the same Tomcat. As it shows in the RootCouse: root cause java.lang.LinkageError: loader constraints violated when linkingjavax/xml/soap/SOAPMessage classatorg.apache.axis.client.Call.init(Call.java:263)atorg.apache.axis.client.Service.createCall (Service.java:566)I started using a simple JSP page but still my Call.init is failing. -Sri At 10:18 AM 5/13/2005, you wrote: Michael, Thanks for your reply. I just started calling the web service in the .jsp file. Here is my client code from .jsp file: % String endpoint = http://localhost:8080/bserv/services/EmployeeDataService ; String[] args = {getEmployeeLateTSDataArray, 22624, 8524}; String method = args[0]; String arg1 = args[1];; String arg2 = args[2];; Service service = new Service(); Call call = null; QName qname = null; Class cls = null; qname = new QName(EmployeeLateTSArray, EmployeeLateTSBean); TypeMappingRegistry tmr = service.getTypeMappingRegistry(); TypeMapping tmlts = tmr.createTypeMapping(); try { tmlts.register( Class.forName(com.bbn.ws.EmployeeLateTSBean), qname, new org.apache.axis.encoding.ser.BeanSerializerFactory(EmployeeLateTSBean.class,qname), new org.apache.axis.encoding.ser.BeanDeserializerFactory(EmployeeLateTSBean.class,qname)); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } tmr.register(http://schemas.xmlsoap.org/soap/encoding/ , tmlts); qname = new QName(EmployeeLateTSArray, EmployeeLateTSBeanArray); call = (Call) service.createCall(); call.setReturnType (qname); try { call.setTargetEndpointAddress(new java.net.URL(endpoint)); } catch (MalformedURLException e2) { e2.printStackTrace(); } call.setOperationName(method); call.addParameter(admnum, XMLType.XSD_INTEGER, ParameterMode.IN); call.addParameter(mgrnum, XMLType.XSD_INTEGER, ParameterMode.IN); call.setReturnType(qname); System.out.println(Called method: + method + ( + arg1 + , + arg2 + )); EmployeeLateTSBean e[] = (EmployeeLateTSBean[])call.invoke(new Object[] { new Integer(arg1), new Integer(arg2) }); % %= e[0].toString(); % I will look into using HttpClient as you suggested. Thanks again, Sri At 05:47 PM 5/12/2005, Michael Oliver wrote: Sri, Its hard to tell what you are doing because we don't see any of the source, but I can tell you that I use commons HttpClient to access one servlet from another servlet all day long with no problems so you can at least know that should work. Michael Oliver CTO Alarius Systems LLC 6800 E. Lake Mead Blvd, #1096 Las Vegas, NV 89156 Phone:(702)643-7425 Fax:(702)974-0341 *Note new email changed from [EMAIL PROTECTED] -- It used to be that machines automated work, giving us moretime to do other things. But now machines automate theproduction of attention-consuming information, which takesour time. For example, if one person sends the same e-mailmessage to 10 people, then 10 people have to respond.Esther Dyson
problem in returning null array in .net
I am running a web service that is returning arrays. the webservice is deployed in Axis1.2RC3. The services is working fine . I can access it with both java and .NET client. However whenever the array is null. I get the following soap response. HTTP/1.1 200 OK Content-Type: text/xml;charset=utf-8 Date: Fri, 13 May 2005 18:50:54 GMT Server: Apache-Coyote/1.1 Connection: close ?xml version=1.0 encoding=utf-8?soapenv:Envelope xmlns: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:Body searchOutput xmlns=http://shantanu.com/DPBean// /soapenv:Body /soapenv:Envelope my java client interprets it as null but not .NET client. I know in my webservice the returned array is null; any thoughts Shantanu -- Graduate Student Department of Computer Science, San Diego State University
Re: Axis newbie, .NET idiot; add web reference of wsdl file generating errors? SOAP header params how-to?
Todd, SOAP Headers are supposed to be defined as document/literal. Axis doesn't support mix and match of soap messages (header in doc/literal and body in rpc/encoded), so it's best to just use doc/literal when using soap headers. On top of that, if you want to interoperate with .NET you should use the wrapped convention. Here's an updated version of your WSDL defined using the wrapped convention: ?xml version=1.0 encoding=UTF-8? wsdl:definitions targetNamespace=http://localhost:8080/avalanche/services/currency; xmlns:impl=http://localhost:8080/avalanche/services/currency; xmlns:intf=http://localhost:8080/avalanche/services/currency; xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:wsdlsoap=http://schemas.xmlsoap.org/wsdl/soap/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; !-- added by me -- wsdl:types xsd:schema targetNamespace=http://localhost:8080/avalanche/services/currency; xmlns:SOAP-ENC=http://schemas.xmlsoap.org/soap/encoding/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsd1=http://localhost:8080/avalanche/services/.xsd1; xsd:element name=authToken xsd:complexType xsd:all xsd:element maxOccurs=1 minOccurs=1 name=value type=xsd:string/ /xsd:all /xsd:complexType /xsd:element !-- wrapper elements added by ATM -- xsd:element name=getExchangeRate xsd:complexType xsd:sequence/ /xsd:complexType /xsd:element xsd:element name=getExchangeRateResponse xsd:complexType xsd:sequence xsd:element name=getExchangeRateReturn type=xsd:double/ /xsd:sequence /xsd:complexType /xsd:element !-- end ATM addition -- /xsd:schema /wsdl:types !-- end addition -- !-- added by me -- wsdl:message name=getExchangeRateRequest !-- ATM changed type to element -- wsdl:part element=intf:authToken name=auth_header/ !-- body part added by ATM -- wsdl:part name=parameters element=intf:getExchangeRate/ !-- end ATM addition -- /wsdl:message !-- end addition -- wsdl:message name=getExchangeRateResponse !-- ATM changed name to parameters and changed type to element -- wsdl:part name=parameters element=intf:getExchangeRateResponse/ /wsdl:message wsdl:portType name=CurrencyWebService wsdl:operation name=getExchangeRate wsdl:input message=impl:getExchangeRateRequest name=getExchangeRateRequest/ wsdl:output message=impl:getExchangeRateResponse name=getExchangeRateResponse/ /wsdl:operation /wsdl:portType wsdl:binding name=currencySoapBinding type=impl:CurrencyWebService !-- ATM changed to style=document -- wsdlsoap:binding style=document transport=http://schemas.xmlsoap.org/soap/http/ !-- added by me -- wsdl:operation name=getExchangeRate wsdlsoap:operation soapAction=/ wsdl:input name=getExchangeRateRequest !-- ATM changed bindings to literal -- wsdlsoap:body parts=parameters use=literal/ wsdlsoap:header message=impl:getExchangeRateRequest part=auth_header use=literal/ /wsdl:input wsdl:output name=getExchangeRateResponse wsdlsoap:body use=literal/ /wsdl:output /wsdl:operation !-- end addition -- /wsdl:binding wsdl:service name=CurrencyWebServiceService wsdl:port binding=impl:currencySoapBinding name=currency wsdlsoap:address location=http://localhost:8080/avalanche/services/currency/ /wsdl:port /wsdl:service /wsdl:definitions On 5/13/05, Todd Grinnell [EMAIL PROTECTED] wrote: I have two questions that I hope y'all can help me with. Here's a little background on why I'm bothering y'all. We've got a bunch of java interfaces being used via RMI, now we want to expose them via web services, too. We do our own authentication, so I was thinking the easiest thing is to have the client call the authentication method, and then pass the resulting authentication token as a header arg-that way the existing java interfaces don't need to change. Question 1) I'm also not such a smartie about wsdl. (I'm sure you're wondering if I'm a smartie about anything ;-) ) The WSDL for my service is below. It works just fine with WSDL2Java, and the generated Java client stubs do just what I want them to. However, when I Add Web Reference in .NET, it gives an error, the element attribute is not allowed on encoded message parts. If I change the part specification from wsdl:part element=intf:authToken name=auth_header/ to wsdl:part type=intf:authToken
Re: problem integrating the client in another web application: AxisServlet threw exception
Don, Thanks for the sample code. I am stranger to NetBeans so... :( BTW, I tried my client code in the Servlet(.java) and it's working. I will try forwarding from .java to .jsp. Hopefully it will work on time for my deadline next week. :) -Sri At 01:57 PM 5/13/2005, you wrote: I've been working on integrating Axis with Netbeans and I just finished the trivial case of using a JSP to consume a WebService. -- [EMAIL PROTECTED] contentType=text/html% [EMAIL PROTECTED] pageEncoding=UTF-8% [EMAIL PROTECTED] import=play.*% html headtitleJSP Page/title/head body % String val=earnest; try{ HiSEI hiStub = new HiSEIServiceLocator().getHiSEIPort(); out.println(hiStub.sayHi(Allison)); }catch (Exception ex){}% /body /html The import references the package play which was created by wsdl2java and contains the two classes referenced in the scriptlet. dga On 5/13/05, Srinadh Karumuri [EMAIL PROTECTED] wrote: Does any one have a sample code for calling an Axis Web service from a JSP page? Interesting thing is: Same code when I tried on Tomcat 3 gives me the following exception: Internal Servlet Error: java.lang.IllegalStateException: Response has already been committed at java.lang.Throwable.fillInStackTrace(Native Method) at java.lang.Throwable.fillInStackTrace(Compiled Code) at java.lang.Throwable.(Compiled Code) at java.lang.Exception.(Compiled Code) at java.lang.RuntimeException.(Compiled Code) at java.lang.IllegalStateException.(Compiled Code) at org.apache.tomcat.core.HttpServletResponseFacade.sendError(Compiled Code) : : -Sri At 01:05 PM 5/13/2005, you wrote: Michael, I checked the HttpClient and understood what you meant. So, it should be working with my web app on the same Tomcat. As it shows in the RootCouse: root cause java.lang.LinkageError: loader constraints violated when linking javax/xml/soap/SOAPMessage class at org.apache.axis.client.Call.init(Call.java:263) at org.apache.axis.client.Service.createCall (Service.java:566) I started using a simple JSP page but still my Call.init is failing. -Sri At 10:18 AM 5/13/2005, you wrote: Michael, Thanks for your reply. I just started calling the web service in the .jsp file. Here is my client code from .jsp file: % String endpoint = http://localhost:8080/bserv/services/EmployeeDataService ; String[] args = {getEmployeeLateTSDataArray, 22624, 8524}; String method = args[0]; String arg1 = args[1];; String arg2 = args[2];; Service service = new Service(); Call call = null; QName qname = null; Class cls = null; qname = new QName(EmployeeLateTSArray, EmployeeLateTSBean); TypeMappingRegistry tmr = service.getTypeMappingRegistry(); TypeMapping tmlts = tmr.createTypeMapping(); try { tmlts.register( Class.forName(com.bbn.ws.EmployeeLateTSBean), qname, new org.apache.axis.encoding.ser.BeanSerializerFactory(EmployeeLateTSBean.class,qname), new org.apache.axis.encoding.ser.BeanDeserializerFactory(EmployeeLateTSBean.class,qname)); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } tmr.register(http://schemas.xmlsoap.org/soap/encoding/ , tmlts); qname = new QName(EmployeeLateTSArray, EmployeeLateTSBeanArray); call = (Call) service.createCall(); call.setReturnType (qname); try { call.setTargetEndpointAddress(new java.net.URL(endpoint)); } catch (MalformedURLException e2) { e2.printStackTrace(); } call.setOperationName(method); call.addParameter(admnum, XMLType.XSD_INTEGER, ParameterMode.IN); call.addParameter(mgrnum, XMLType.XSD_INTEGER, ParameterMode.IN); call.setReturnType(qname); System.out.println(Called method: + method + ( + arg1 + , + arg2 + )); EmployeeLateTSBean e[] = (EmployeeLateTSBean[])call.invoke(new Object[] { new Integer(arg1), new Integer(arg2) }); % %= e[0].toString(); % I will look into using HttpClient as you suggested. Thanks again, Sri At 05:47 PM 5/12/2005, Michael Oliver wrote: Sri, Its hard to tell what you are doing because we don't see any of the source, but I can tell you that I use commons HttpClient to access one servlet from another servlet all day long with no problems so you can at least know that should work. Michael Oliver CTO Alarius Systems LLC 6800 E. Lake Mead Blvd, #1096 Las Vegas, NV 89156 Phone:(702)643-7425 Fax:(702)974-0341 *Note new email changed from [EMAIL PROTECTED] -- It used to be that machines automated work, giving us more time to do other things. But now machines automate the production of attention-consuming information, which takes our time. For example, if one person sends the same e-mail message to 10 people, then 10 people have to respond. Esther Dyson