Page 2 of 2

Posted: Tue Jul 29, 2008 8:16 am
by maschoff
We are really busy with our commercial stuff right now and - at the moment - we have no clue what could be the problem. It would be nice if someone else from the open source community could have a look at the source code and try to fix it. We would gladly include any fix into the main line.

Posted: Tue Jul 29, 2008 8:38 pm
by asai
Well, I can try to look at it when I have the time, I wouldn't mind, it's just a matter of time for me as well, plus I know next to nothing about Java, but if I can find a solution I will.

But, can you tell me what people are using for their webservices if not PHP and/or Flex? JSP? ASP? Things like this?

SAXException: Bad types - Exception StringArrayType

Posted: Thu Jul 31, 2008 5:57 pm
by Thiemer
ma wrote:We are really busy with our commercial stuff right now and - at the moment - we have no clue what could be the problem. It would be nice if someone else from the open source community could have a look at the source code and try to fix it. We would gladly include any fix into the main line.
Hello,

I am sorry to bother you regarding the same topic. I got the wsdl-file, generated the Java-classes by means of an ant-Task in eclipse:

Code: Select all

    <target 
       name="generate-client-code"  
       description="Generate Java source files from XSDL.">

		<taskdef resource="axis-tasks.properties"
		  classpathref="axis.classpath"/>

    	<delete failonerror="false">
    		<fileset dir="${base}/src-generated/de/.../openemm/web">
    			<include name="*.*"/>
    		</fileset>
    	</delete>
    	<axis-wsdl2java
	  	  output="${base}/../src-generated"
	  	  testcase="true"
	  	  verbose="true"
	      typemappingversion="1.2"
  	      url="${base}/../lib/openemm/ws.wsdl" >
	  	    <mapping
	  	      namespace="urn:agnitas-webservice"
	  	      package="de.[...].openemm.web" />
		</axis-wsdl2java>

  </target>
When I am trying to use the webservice-methods, some are working and some are not: for instance: "findSubscriber" and "deleteSubscriber" are working perfectly.

However, when I try to use "getSubscriber" I get the following error message:

Code: Select all

	at java.lang.Thread.run(Thread.java:595)
18:38:30,948 ERROR [STDERR] AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: java.lang.IllegalArgumentException: array element type mismatch
 faultActor: 
 faultNode: 
 faultDetail: 
	{http://xml.apache.org/axis/}stackTrace:java.lang.IllegalArgumentException: array element type mismatch
	at org.apache.axis.encoding.ser.BeanPropertyTarget.set(BeanPropertyTarget.java:157)
	at org.apache.axis.encoding.DeserializerImpl.valueComplete(DeserializerImpl.java:249)
	at org.apache.axis.encoding.ser.ArrayDeserializer.valueComplete(ArrayDeserializer.java:583)
	at org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:509)
	at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
	at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:171)
	at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
	at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:369)
	at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048)
	at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
	at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
	at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:369)
	at org.apache.axis.encoding.ser.BeanDeserializer.startElement(BeanDeserializer.java:154)
	at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048)
	at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
	at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
	at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
	at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
	at org.apache.axis.client.Call.invoke(Call.java:2467)
	at org.apache.axis.client.Call.invoke(Call.java:2366)
	at org.apache.axis.client.Call.invoke(Call.java:1812)
	at de.[...].openemm.web.Emm_webserviceSoapBindingStub.getSubscriber(Emm_webserviceSoapBindingStub.java:688)
Similar, when I use "addSubscriber" I get the following Error-Message

Code: Select all

18:41:06,160 ERROR [STDERR] AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object; -> class org.agnitas.webservice.StringArrayType)
 faultActor: 
 faultNode: 
 faultDetail: 
	{http://xml.apache.org/axis/}hostname:ems-wks-001
18:41:06,160 ERROR [STDERR] org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object; -> class org.agnitas.webservice.StringArrayType)
18:41:06,160 ERROR [STDERR] 	at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
18:41:06,160 ERROR [STDERR] 	at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
18:41:06,160 ERROR [STDERR] 	at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
18:41:06,160 ERROR [STDERR] 	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
18:41:06,160 ERROR [STDERR] 	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
18:41:06,160 ERROR [STDERR] 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
18:41:06,160 ERROR [STDERR] 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
18:41:06,160 ERROR [STDERR] 	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
18:41:06,160 ERROR [STDERR] 	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
18:41:06,160 ERROR [STDERR] 	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
18:41:06,160 ERROR [STDERR] 	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
18:41:06,160 ERROR [STDERR] 	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
18:41:06,160 ERROR [STDERR] 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
18:41:06,160 ERROR [STDERR] 	at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
18:41:06,160 ERROR [STDERR] 	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
18:41:06,160 ERROR [STDERR] 	at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
18:41:06,160 ERROR [STDERR] 	at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
18:41:06,160 ERROR [STDERR] 	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
18:41:06,160 ERROR [STDERR] 	at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
18:41:06,160 ERROR [STDERR] 	at org.apache.axis.client.Call.invoke(Call.java:2767)
18:41:06,160 ERROR [STDERR] 	at org.apache.axis.client.Call.invoke(Call.java:2443)
18:41:06,160 ERROR [STDERR] 	at org.apache.axis.client.Call.invoke(Call.java:2366)
18:41:06,160 ERROR [STDERR] 	at org.apache.axis.client.Call.invoke(Call.java:1812)
18:41:06,160 ERROR [STDERR] 	at de.ems.pflegeportal.schnittstelle.openemm.web.Emm_webserviceSoapBindingStub.addSubscriber(Emm_webserviceSoapBindingStub.java:657)
Both error-messages seem to show that there is a problem with the mapping of the StringArrayType.

Searching the web, I read that axis has changed between two versions in some way how Arrays are supposed to be declared in complex types in the wsdl-file. For that reason I checked that I am using the same axis-version as you do in Openemm. And this is the case. Additionately I tried to build the java-classes for the webservice with the anttask-Option typemappingversion="1.1" (additionately to 1.2 - the second option). However, this did not change the situation.

My application runs on a JBoss 4.2.1.

I would very much appreciate you help. Thank you!

Stefan

your error report

Posted: Fri Aug 01, 2008 7:38 am
by maschoff
Thank you for this detailed error report! This will help us to find the problem. Do I understand it right that you are using JBoss instead of Resin as application server/servlet container for OpenEMM?

Posted: Mon Aug 04, 2008 8:04 am
by Thiemer
Hallo,

excuse me for answering so late, but I was not working on Friday.No, I am not using JBoss as application server container for OpenEMM. For OpenEMM I am using the Windows-Resin implementation. But for my client application I am using JBoss (version 4.2.1), which is presently - in the phase of development - also running on my local windows machine, but on a different port.

Thus, for testing it might be helpful for you to implement the client on a JBoss, if you cannot reproduce the error on Resin. In an other forum I read about a case, in which the Bad types-exception disapperead when the SOAP-server was installed in the same application server (instead of a combination of Websphere and Jboss). Unfortunately the case was not further explored there. But perhaps this hint helps (though this should not be "the" solution).

Thank you for your help!

Stefan

wrong type?

Posted: Wed Aug 06, 2008 3:13 pm
by maschoff
Please check in class "SubscriberData" methods "setParamNames" and "setParamValues". The type of the parameter in each case should be "org.agnitas.webservice.StringArrayType" - not String[]. Is this so?

Re: wrong type?

Posted: Wed Aug 06, 2008 6:13 pm
by Thiemer
ma wrote:Please check in class "SubscriberData" methods "setParamNames" and "setParamValues". The type of the parameter in each case should be "org.agnitas.webservice.StringArrayType" - not String[]. Is this so?
Thank you for your reply. Because of this I have found the solution!

When the ant-task "axis-wsdl2java" of Axis-version 1.4 is executed (in my case via Ant) the "StringArrayType" is mapped to String[].

So only six classes are generated:
- Emm_webserviceSOAPBindingStub
- EmmWebService_Port
- EmmWebService_PortService
- EmmWebService_PortLocator
- EmmWebService_PortServiceTestCase
- SuscriberData

The class "StringArrayType" is missing.

Searching the net I have found that Axis, version 1.4., has an additional not documented option "wrapArrays". If set to "false" (the default setting of wsdl2java, version 1.4), complexTypes which only wrap Arrays, even though declared as such in the wsdl, are substituted by Arrays in the created classes.

However for the webservice of Openemm this creates a conflict with the server side when using the so configured client.

However, if you set the undocumented wrapArray-option to

Code: Select all

wrapArrays="true"
the ComplexTypes in the wsdl, that only wrap arrays, are no longer substituted. Thus in our case also a class "StringArrayType" is generated.

I have not yet tried all methods of the webservice, but the one I have tried are working now.

Additionately I have set the typeMappingVersion of "wsdl2java" to Version 1.3.

Code: Select all

typeMappingVersion="1.3"
With this setting the webservice-methods I tried are working. However, I have not tried the other possible options "1.1" and "1.2" nor have I checked all methods of the webservice.

Perhaps it would be helpful to add this aspect of the task "wsdl2java" of Axis 1.4 to the documentation of OpenEmm.

Apart of the upper problem, I would like to suggest to add to the windows-version of Openemm "cmd"-scripts for the generation of the wsdl-file. The "sh"-scripts also added to the windows-version are not very helpful here. Since we have rewritten the scripts ourselves, I could mail them to the OpenEMM-Team, if you would send me an email-address of yours.

good job!

Posted: Wed Aug 06, 2008 9:31 pm
by maschoff
Thanks a lot for your research and your effort to fix this problem! My e-mail address: maschoff AT agnitas DOT org.

Thank you for posting this stuff!

Posted: Fri Mar 13, 2009 7:33 pm
by HamburgerTS
I just want to say that i'm grateful to you - Thiemer - for posting all the StringArrayType-Stuff.

I've just added my first Subscriber via Java... :mrgreen:

Are there any plans on fixing this for OpenEMM 5.5.1?

Posted: Fri Mar 13, 2009 11:54 pm
by asai
Are there any plans on fixing this for 5.5.2? Or can anyone help me to get this working with Ant and Axis? Still would really like to see this work...Can anyone give me a quick tutorial on this?

Re: Thank you for posting this stuff!

Posted: Tue Mar 17, 2009 11:58 pm
by lbrenes
HamburgerTS wrote:I just want to say that i'm grateful to you - Thiemer - for posting all the StringArrayType-Stuff.

I've just added my first Subscriber via Java... :mrgreen:
Hi HamburgerTS,
Can you share your example? I have the same problem with PHP and don't kwnow how to solve it!
Thanks a lot.

Re: wrong type?

Posted: Wed Mar 18, 2009 12:01 am
by lbrenes
Thiemer wrote: Thank you for your reply. Because of this I have found the solution!
What do I need to modified. It's not working to me. Please! Thanks a lot!

My PHP Solution

Posted: Fri Mar 20, 2009 2:49 pm
by lbrenes
Hi everyone, i solved this problem. Please see this post at http://www.openemm.org/forums/viewtopic.php?p=3384#3384