Hi Anne

By "simple type", do you mean "primitive type"? Such as int (note, no package) vs. java.lang.Integer? There is no primitive type for a String, it is always an instance of the class java.lang.String. I have been developing in java for 5 years, and am also a lecturer on the subject - So unless i've been missing something big, I don't think that's it :-)

But your comment holds true: This is generated code, so this must be a bug - though I need to find out if anybody else has used String attributes in axis? (Specifically 1.2RC)

 - Dawid Loubser



Anne Thomas Manes wrote:
In Java, "string" is a simple type; "String" is not. The question is why did
Axis map your CurrencySymbolT type to "String" rather than "string", and
since it did so, why does the code expect a simple type. Since this is all
generated code, I'd say this is a bug. Please file a bug report.

As a work around, you could try modifying your bean and define
CurrencySymbol as type java.lang.string. (This may cause other problems in
the serializer, though.)

Anne

-----Original Message-----
From: Dawid Loubser [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 2:18 AM
To: [EMAIL PROTECTED]
Subject: Help! String xs:attributes not supported?
(java.lang.reflect.InvocationTargetException)


Hi, I have a serious problem with Axis 1.2 - in my schema (which I have no
control over), I basically have a type which represents a currency: It's a
complex type, with a xs:string attribute for Currency Symbol:

<complexType name="CurrencyT">
  <sequence>
   <element minOccurs="1" maxOccurs="1" name="Value"
type="i0:CurrencyValueT" />
  </sequence>
  <attribute form="qualified" use="required" name="CurrencySymbol"
type="i0:CurrencySymbolT" />
</complexType>

and

<simpleType name="CurrencySymbolT">
   <restriction base="string">
     <pattern value="(\S){1,3}" />
   </restriction>
</simpleType>

Everything is document/literal in the schema.

wsdl2java compilation runs perfectly (and infinitely better than Sun's
crap implementation) - and my service compiles and deploys fine. When,
however, I request the WSDL from <service_name>?wsdl I get the following
error: (the second part ['Caused by'] is the interesting bit):


java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.axis.transport.http.AxisServlet.processQuery(AxisServlet.java:111 6) at org.apache.axis.transport.http.AxisServlet.doGet(AxisServlet.java:224) at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java: 301) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:284) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:204) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:256) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext Valve.java:245) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:199) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195 ) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164 ) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:149) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :156) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:805) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne ction(Http11Protocol.java:696) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav a:677) at java.lang.Thread.run(Thread.java:534)

Caused by: Bean attribute CurrencySymbol is of type java.lang.String,
which is not a simple type
         at
org.apache.axis.encoding.ser.BeanSerializer.writeAttribute(BeanSerializer.ja
va:460)
         at
org.apache.axis.encoding.ser.BeanSerializer.writeSchema(BeanSerializer.java:
344)
         at
org.apache.axis.wsdl.fromJava.Types.makeTypeElement(Types.java:1774)
         at org.apache.axis.wsdl.fromJava.Types.writeType(Types.java:972) at
org.apache.axis.encoding.ser.BeanSerializer.writeField(BeanSerializer.java:4
22)
         at
org.apache.axis.encoding.ser.BeanSerializer.writeSchema(BeanSerializer.java:
350)
         at
org.apache.axis.wsdl.fromJava.Types.makeTypeElement(Types.java:1774)
         at
org.apache.axis.wsdl.fromJava.Types.writeElementDecl(Types.java:1191)
         at
org.apache.axis.wsdl.fromJava.Emitter.writePartToMessage(Emitter.java:1915)
         at
org.apache.axis.wsdl.fromJava.Emitter.writeResponseMessage(Emitter.java:1726
)
         at
org.apache.axis.wsdl.fromJava.Emitter.writeMessages(Emitter.java:1102)
         at
org.apache.axis.wsdl.fromJava.Emitter.writePortType(Emitter.java:1056)
         at org.apache.axis.wsdl.fromJava.Emitter.getWSDL(Emitter.java:471)
at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:322) at
org.apache.axis.providers.BasicProvider.generateWSDL(BasicProvider.java:237)
         at
org.apache.axis.strategies.WSDLGenStrategy.visit(WSDLGenStrategy.java:33)
         at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at
org.apache.axis.SimpleChain.generateWSDL(SimpleChain.java:104) at
org.apache.axis.handlers.soap.SOAPService.generateWSDL(SOAPService.java:316)
         at
org.apache.axis.server.AxisServer.generateWSDL(AxisServer.java:467)
         at
org.apache.axis.transport.http.QSWSDLHandler.invoke(QSWSDLHandler.java:68)
         ... 33 more

Why does it seem that Axis does not like the idea of String being a simple
type? (which a String attribute must surely be). It's not a matter of Java
primitive types or not - if I change that attribute to either xs:integer
(java.lang.Integer) or xs:int (Java: int) everything goes well, so it's
specifically the String that's causing issues.

I have switched our project over to Axis (from JAX-RPC SI) in an
emergency, and now I'm having these issues (placing it at risk) - if anybody
can help me resolve them I shall be most grateful.


  - Dawid Loubser


Reply via email to