Axis2-xmlbeans-EJB3-Extension-B-Character

Class MyEJB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package my.test;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import xx.webservices.type.ESubmissionBatchType;
import xx.webservices.type.ESubmissionListType;
import xx.webservices.type.YYSubmissionRequestDocument;
import xx.webservices.type.YYSubmissionResponseDocument;

import javax.annotation.security.PermitAll;
import javax.ejb.EJBException;
import javax.ejb.Stateless;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;

@Stateless(name = "MyEJB")
@TransactionManagement(TransactionManagementType.BEAN)
@PermitAll
public class MyEJB implements IMyEJB, IMyEJBLocal {
public YYSubmissionResponseDocument getYYSubmission(YYSubmissionRequestDocument YYSubmissionRequest)
throws EJBException {
YYSubmissionResponseDocument outDoc = YYSubmissionResponseDocument.Factory.newInstance();
ESubmissionBatchType esubBatchType = outDoc.addNewYYSubmissionResponse().addNewOut();
Calendar fromDate = Calendar.getInstance();
Calendar toDate = Calendar.getInstance();

esubBatchType.setFromDateTime(fromDate);
esubBatchType.setToDateTime(toDate);

List<String> returnList = new ArrayList<String>();
String a = "\uD840\udcd9";
String b = "\uD840\udc59";
returnList.add(a);
returnList.add(b);

ESubmissionListType eSubmitListType = esubBatchType.addNewESubmissionList();
for (int i = 0; i < returnList.size(); i++) {
eSubmitListType.addESubmission(returnList.get(i));
}

esubBatchType.setNoOfSubmission(new Integer(eSubmitListType.sizeOfESubmissionArray()).toString());

return outDoc;

}
}

Interface IMyEJB

1
2
3
4
5
6
7
8
9
10
11
12
13
package my.test;

import xx.webservices.type.YYSubmissionRequestDocument;
import xx.webservices.type.YYSubmissionResponseDocument;

import javax.ejb.EJBException;
import javax.ejb.Remote;

@Remote
public interface IMyEJB {
public YYSubmissionResponseDocument getYYSubmission(YYSubmissionRequestDocument YYSubmissionRequest)
throws EJBException;
}

Interface IMyEJBLocal

1
2
3
4
5
6
7
8
9
10
11
12
13
package my.test;

import xx.webservices.type.YYSubmissionRequestDocument;
import xx.webservices.type.YYSubmissionResponseDocument;

import javax.ejb.EJBException;
import javax.ejb.Local;

@Local
public interface IMyEJBLocal {
public YYSubmissionResponseDocument getYYSubmission(YYSubmissionRequestDocument YYSubmissionRequest)
throws EJBException;
}

Class ABCSkeleton

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package my.test;

public class ABCSkeleton {

public xx.webservices.type.YYSubmissionResponseDocument getYYSubmission(
xx.webservices.type.YYSubmissionRequestDocument YYSubmissionRequest) {

xx.webservices.type.YYSubmissionResponseDocument outDoc = null;
try {
outDoc = getMyEJB().getYYSubmission(YYSubmissionRequest);
return outDoc;
} catch (Exception e) {
log.error("Exception in getYYSubmission", e);
throw new java.lang.UnsupportedOperationException(e);
}
}

private IMyEJB getMyEJB() throws Exception {
InitialContext initialContext = new InitialContext();
IMyEJB myEJB = (IMyEJB) initialContext.lookup("java:app/my_app/MyEJB!my.test.IMyEJB");
return myEJB;
}
}

application.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?xml version="1.0" encoding="UTF-8"?>
<application
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd"
version="6">

<application-name>ww_ds</application-name>
<initialize-in-order>true</initialize-in-order>

<module>
<web>
<web-uri>axis2.war</web-uri>
<context-root>yy_ws</context-root>
</web>
</module>
<module>
<ejb>my_app.jar</ejb>
</module>
<library-directory>lib</library-directory>
</application>

Deploy this ear to JBoss EAP 6.4

copy the yy.ear to folder sftp://support@10.13.135.37//opt/software/jboss-eap-6.4/standalone/deployments/

Call webservice via http

curl http://10.13.135.37:9080/yy_ws/services/esubmission/getYYSubmission
Throw error as

1
2
3
4
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<faultstring>
java.lang.RuntimeException: JBAS014154: Failed to marshal EJB parameters
</faultstring>

Trace log in /tmp/axis2.log

In yy.ear/axis2.war/WEB-INF/classes/log4j.properties, set option log4j.rootCategory=INFO, CONSOLE, LOGFILE and log4j.appender.LOGFILE.File=/tmp/axis2.log
Found error as

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
2016-01-05 19:02:29,194 [http-/0.0.0.0:9080-1] INFO  stdout  - 	at org.apache.xmlbeans.impl.values.XmlObjectBase$SerializedRootObject.readObject(XmlObjectBase.java:2652)
2016-01-05 19:02:29,194 [http-/0.0.0.0:9080-1] INFO stdout - at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2016-01-05 19:02:29,194 [http-/0.0.0.0:9080-1] INFO stdout - at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2016-01-05 19:02:29,194 [http-/0.0.0.0:9080-1] INFO stdout - at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2016-01-05 19:02:29,194 [http-/0.0.0.0:9080-1] INFO stdout - at java.lang.reflect.Method.invoke(Method.java:497)
2016-01-05 19:02:29,194 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:307)
2016-01-05 19:02:29,194 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:303)
2016-01-05 19:02:29,194 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:251)
2016-01-05 19:02:29,194 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:172)
2016-01-05 19:02:29,194 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:128)
2016-01-05 19:02:29,194 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:295)
2016-01-05 19:02:29,194 [http-/0.0.0.0:9080-1] INFO stdout - ... 42 more
2016-01-05 19:02:29,195 [http-/0.0.0.0:9080-1] INFO stdout - Caused by: org.apache.xmlbeans.XmlException: error: Illegal XML Character: 0xd840
2016-01-05 19:02:29,195 [http-/0.0.0.0:9080-1] INFO stdout - org.apache.xmlbeans.impl.piccolo.io.IllegalCharException: Illegal XML Character: 0xd840
2016-01-05 19:02:29,195 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.xmlbeans.impl.piccolo.xml.XMLReaderReader.read(XMLReaderReader.java:146)
2016-01-05 19:02:29,195 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yy_refill(PiccoloLexer.java:3474)
2016-01-05 19:02:29,195 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yylex(PiccoloLexer.java:3958)
2016-01-05 19:02:29,195 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yylex(Piccolo.java:1290)
2016-01-05 19:02:29,195 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yyparse(Piccolo.java:1400)
2016-01-05 19:02:29,195 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:714)
2016-01-05 19:02:29,195 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3435)
2016-01-05 19:02:29,195 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.xmlbeans.impl.store.Locale.parse(Locale.java:706)
2016-01-05 19:02:29,195 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:690)
2016-01-05 19:02:29,195 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:677)
2016-01-05 19:02:29,195 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:208)
2016-01-05 19:02:29,195 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.xmlbeans.impl.values.XmlObjectBase$SerializedRootObject.readObject(XmlObjectBase.java:2648)
2016-01-05 19:02:29,196 [http-/0.0.0.0:9080-1] INFO stdout - at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2016-01-05 19:02:29,196 [http-/0.0.0.0:9080-1] INFO stdout - at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2016-01-05 19:02:29,196 [http-/0.0.0.0:9080-1] INFO stdout - at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2016-01-05 19:02:29,196 [http-/0.0.0.0:9080-1] INFO stdout - at java.lang.reflect.Method.invoke(Method.java:497)
2016-01-05 19:02:29,196 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:307)
2016-01-05 19:02:29,196 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:303)
2016-01-05 19:02:29,196 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:251)
2016-01-05 19:02:29,196 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:172)
2016-01-05 19:02:29,196 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:128)
2016-01-05 19:02:29,196 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:295)
2016-01-05 19:02:29,196 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:286)
2016-01-05 19:02:29,196 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:258)
2016-01-05 19:02:29,196 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:184)
2016-01-05 19:02:29,196 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.ejb.client.EJBObjectInterceptor.handleInvocation(EJBObjectInterceptor.java:58)
2016-01-05 19:02:29,197 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:186)
2016-01-05 19:02:29,197 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.ejb.client.EJBHomeInterceptor.handleInvocation(EJBHomeInterceptor.java:83)
2016-01-05 19:02:29,197 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:186)
2016-01-05 19:02:29,197 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:42)
2016-01-05 19:02:29,197 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:186)
2016-01-05 19:02:29,197 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:125)
2016-01-05 19:02:29,197 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:186)
2016-01-05 19:02:29,197 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:255)
2016-01-05 19:02:29,197 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:200)
2016-01-05 19:02:29,197 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:183)
2016-01-05 19:02:29,197 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:146)
2016-01-05 19:02:29,197 [http-/0.0.0.0:9080-1] INFO stdout - at com.sun.proxy.$Proxy36.getYYSubmission(Unknown Source)
2016-01-05 19:02:29,197 [http-/0.0.0.0:9080-1] INFO stdout - at xx.webservices.esubmission.EsubmissionSkeleton.getYYSubmission(EsubmissionSkeleton.java:64)
2016-01-05 19:02:29,197 [http-/0.0.0.0:9080-1] INFO stdout - at xx.webservices.esubmission.EsubmissionMessageReceiverInOut.invokeBusinessLogic(EsubmissionMessageReceiverInOut.java:51)
2016-01-05 19:02:29,197 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42)
2016-01-05 19:02:29,198 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
2016-01-05 19:02:29,198 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
2016-01-05 19:02:29,198 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:125)
2016-01-05 19:02:29,198 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:119)
2016-01-05 19:02:29,198 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:799)
2016-01-05 19:02:29,198 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:242)
2016-01-05 19:02:29,198 [http-/0.0.0.0:9080-1] INFO stdout - at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
2016-01-05 19:02:29,198 [http-/0.0.0.0:9080-1] INFO stdout - at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
2016-01-05 19:02:29,198 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
2016-01-05 19:02:29,198 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
2016-01-05 19:02:29,198 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
2016-01-05 19:02:29,198 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
2016-01-05 19:02:29,198 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
2016-01-05 19:02:29,198 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
2016-01-05 19:02:29,199 [http-/0.0.0.0:9080-1] INFO stdout - at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
2016-01-05 19:02:29,199 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150)
2016-01-05 19:02:29,199 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
2016-01-05 19:02:29,199 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
2016-01-05 19:02:29,199 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
2016-01-05 19:02:29,199 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854)
2016-01-05 19:02:29,199 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
2016-01-05 19:02:29,199 [http-/0.0.0.0:9080-1] INFO stdout - at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)
2016-01-05 19:02:29,199 [http-/0.0.0.0:9080-1] INFO stdout - at java.lang.Thread.run(Thread.java:745)

Update method read in class XMLReaderReader from source code of xmlbeans

1
2
3
4
5
6
7
8
9
10
11
12
13
14
if (c >= 0x20) {
if ((c <= 0xD7FF) ||
(c >= 0xE000 && c <= 0xFFFD) ||
(c >= 0x10000 && c <= 0x10FFFF) ||
// bypass surrogate pair character
XMLChar.isHighSurrogate(c) || XMLChar.isLowSurrogate(c)) {

sawCR = false;
destbuf[off+ (charsRead++)] = c;
}
else
throw new IllegalCharException(
"Illegal XML Character: 0x"+Integer.toHexString(c));
}

Call webservice via http again

curl http://10.13.135.37:9080/yy_ws/services/esubmission/getYYSubmission
Result as

1
2
3
4
5
6
7
8
9
10
11
12
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<type:YYSubmissionResponse xmlns:type="http://www.yy.gov.hk/ww/lsexchange/type">
<type:out xmlns:type="http://www.yy.gov.hk/ww/lsexchange/type">
<type:FromDateTime xmlns:type="http://www.yy.gov.hk/ww/lsexchange/type">2016-01-05T19:53:15.159+08:00</type:FromDateTime>
<type:ToDateTime xmlns:type="http://www.yy.gov.hk/ww/lsexchange/type">2016-01-05T19:53:15.159+08:00</type:ToDateTime>
<type:NoOfSubmission xmlns:type="http://www.yy.gov.hk/ww/lsexchange/type">2</type:NoOfSubmission>
<type:eSubmissionList xmlns:type="http://www.yy.gov.hk/ww/lsexchange/type">
<type:eSubmission xmlns:type="http://www.yy.gov.hk/ww/lsexchange/type">𠃙</type:eSubmission>
<type:eSubmission xmlns:type="http://www.yy.gov.hk/ww/lsexchange/type">𠁙</type:eSubmission>
</type:eSubmissionList>
</type:out>
</type:YYSubmissionResponse>