我正在公开一个Web服务,它接受数据并将此数据插入到DB中,如果插入完成则返回successFlag。我没有使用任何界面。 Web参数直接在实现类本身中给出。测试时,正在插入数据。但收到的SOAP响应显示了JAXBWrapperException。
PFB实现java代码,WSDL,soap响应和堆栈跟踪。请告诉我有什么问题。
@WebService 公共类Service11_SAPCall {
Connection connect = null;
ResultSet result = null;
public void GetSrnDetails(
@WebParam(name = "clear_db", mode = WebParam.Mode.IN) String clear_db,
@WebParam(name = "count", mode = WebParam.Mode.IN) int count,
@WebParam(name = "srnList", mode = WebParam.Mode.IN) srnDetailsBean[] srnList,
@WebParam(name = "status", mode = WebParam.Mode.IN) String status,
@WebParam(name = "successflag", mode = WebParam.Mode.OUT) Holder<String> successFlag,
@WebParam(name = "failedSrnList", mode = WebParam.Mode.OUT) Holder<ArrayList<String>> failedSrnList)
{
boolean dataFlag = false; //to identify if data is being inserted
ArrayList<String> failed_srn_list = new ArrayList<String>();
Logger LOGGER = null;
try
{
Handler fh = new FileHandler("/data/build/Service11.log");
LOGGER = Logger.getLogger(Service10_SAPCall.class.getName());
Logger.getLogger("LOGGER").addHandler(fh);
LOGGER.info("Logger Name : "+LOGGER.getName());
System.out.println("GetSrnDetails execution begins");
System.out.println("Inside GetSrnDetails");
LOGGER.info("Inside GetSrnDetails");
Properties props = new Properties();
FileInputStream fin = null;
fin = new FileInputStream("/data/build/ENivesh/Properties/DB_connection.txt");
props.load(fin);
//DB connection details
String connection_url=props.getProperty("DCURL");
String uname=props.getProperty("DCUserId");
String pwd=props.getProperty("DCPwd");
fin.close();
//Load Driver
Class.forName("com.ibm.db2.jcc.DB2Driver");
System.out.println("Driver Loaded");
System.out.println("connection_url="+connection_url+"\nuname="+uname+"\npwd="+pwd);
System.out.println("Inside getcount");
connect = DriverManager.getConnection(connection_url,uname,pwd);
connect.setAutoCommit(false);
Statement stmt_insertCount = connect.createStatement();
int insert_count_status = 0;
int insert_data_status[] = null;
//Inserting the received count and status to DB
String insert_count = "insert into SRN_COUNT_SERVICE11(DSD_SRN_STATUS,SRN_COUNT) values ('"+status+"','"+count+"')";
insert_count_status=stmt_insertCount.executeUpdate(insert_count);
//Inserting data passed if any.Data is passed only for beyond time line statuses.
if(status.equalsIgnoreCase("HIAB-BT") || status.equalsIgnoreCase("WIPG-BT") || status.equalsIgnoreCase("PTPR-BT")
|| status.equalsIgnoreCase("UPDH-BT") || status.equalsIgnoreCase("PPRE-BT") || status.equalsIgnoreCase("PDMD-BT")
|| status.equalsIgnoreCase("UPAO-BT") || status.equalsIgnoreCase("PQAO-BT") || status.equalsIgnoreCase("PQRO-BT")
|| status.equalsIgnoreCase("PAID-BT") || status.equalsIgnoreCase("PQDH-BT") || status.equalsIgnoreCase("UPDH-BT"))
{
if(srnList.length != 0)
{
Statement stmt_insertData = connect.createStatement();
String insert_data = null;
for(int i=0; i<srnList.length; i++)
{
insert_data = "insert into SRN_DTLS_SERVICE11 values "
+ "('"+srnList[i].getSrn()+"','"+srnList[i].getStatus()+"','"
+srnList[i].getUserId()+"','"+srnList[i].getMobileNumber()+"','"
+srnList[i].getCompanyEmailId()+"','"+srnList[i].getAddressType()+"','"+srnList[i].getAddress()+"','"
+srnList[i].getCityCode()+"','"+srnList[i].getStateCode()+"','"+srnList[i].getDistrictCode()+"','"+srnList[i].getCountry()+"','"
+srnList[i].getCompanyname()+"','"+srnList[i].getTelNo()+"','"+srnList[i].getRocCode()+"','"+srnList[i].getDate()+"')";
stmt_insertData.addBatch(insert_data);
}
insert_data_status = stmt_insertData.executeBatch();
for(int j=0; j<insert_data_status.length; j++)
{
if(!(insert_data_status[j]>0))
failed_srn_list.add(srnList[j].getSrn());
}
dataFlag = true; //setting to true as data was inserted
}
}
connect.commit();
if(insert_count_status > 0) {
if(dataFlag) { //If data is inserted, failed_srn_list is checked to see if any insertions failed.If no X is passed.
if (failed_srn_list.size() == 0) {
successFlag.value = "X";
}
else {
failedSrnList.value.addAll(failed_srn_list); //if there are failed insertions, the failed SRNs are passed back to SAP.
}
} //If dataFlag is not set, only insertion of count is considered to set successFlag.
else {
successFlag.value = "X";
}
}
} catch (Exception ex) {
ex.printStackTrace();
LOGGER.severe(ex.getMessage());
}
finally {
try {
connect.close();
} catch (SQLException e) {
e.printStackTrace();
LOGGER.severe(e.getMessage());
}
}
}
}
WSDL
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sap="http://sapservice.me.org/">
<soapenv:Header/>
<soapenv:Body>
<sap:GetSrnDetails>
<!--Optional:-->
<clear_db></clear_db>
<count></count>
<!--Zero or more repetitions:-->
<srnList>
<!--Optional:-->
<srn></srn>
<!--Optional:-->
<status></status>
<!--Optional:-->
<date></date>
<!--Optional:-->
<userId></userId>
<!--Optional:-->
<mobileNumber></mobileNumber>
<!--Optional:-->
<companyEmailId></companyEmailId>
<!--Optional:-->
<addressType>Home</addressType>
<!--Optional:-->
<address>home</address>
<!--Optional:-->
<cityCode>cuty</cityCode>
<!--Optional:-->
<stateCode>state</stateCode>
<!--Optional:-->
<districtCode></districtCode>
<!--Optional:-->
<country></country>
<!--Optional:-->
<telNo></telNo>
<!--Optional:-->
<companyname></companyname>
<!--Optional:-->
<rocCode></rocCode>
</srnList>
<!--Optional:-->
<status></status>
</sap:GetSrnDetails>
</soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>org.apache.axis2.jaxws.wrapper.impl.JAXBWrapperException: An internal assertion error occurred. The org.me.sapservice.jaxws.GetSrnDetailsResponse JAXB object does not have a successflag xml property.</faultstring>
<detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
堆栈跟踪
000000b9 AxisEngine E org.apache.axis2.engine.AxisEngine receive org.apache.axis2.jaxws.wrapper.impl.JAXBWrapperException: An internal assertion error occurred. The org.me.sapservice.jaxws.GetSrnDetailsResponse JAXB object does not have a successflag xml property.
org.apache.axis2.AxisFault: org.apache.axis2.jaxws.wrapper.impl.JAXBWrapperException: An internal assertion error occurred. The org.me.sapservice.jaxws.GetSrnDetailsResponse JAXB object does not have a successflag xml property.
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:242)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:208)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at com.ibm.ws.websvcs.transport.http.WASAxis2Servlet.doPost(WASAxis2Servlet.java:1583)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1227)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:776)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:458)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1032)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3761)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:976)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
Caused by: javax.xml.ws.WebServiceException: org.apache.axis2.jaxws.wrapper.impl.JAXBWrapperException: An internal assertion error occurred. The org.me.sapservice.jaxws.GetSrnDetailsResponse JAXB object does not have a successflag xml property.
at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:175)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:128)
at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMethodMarshaller.marshalResponse(DocLitWrappedMethodMarshaller.java:511)
at org.apache.axis2.jaxws.server.dispatcher.JavaBeanDispatcher.createResponse(JavaBeanDispatcher.java:349)
at org.apache.axis2.jaxws.server.dispatcher.JavaBeanDispatcher.invoke(JavaBeanDispatcher.java:141)
at org.apache.axis2.jaxws.server.EndpointController.invoke(EndpointController.java:111)
at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:161)
... 29 more
Caused by: org.apache.axis2.jaxws.wrapper.impl.JAXBWrapperException: An internal assertion error occurred. The org.me.sapservice.jaxws.GetSrnDetailsResponse JAXB object does not have a successflag xml property.
at org.apache.axis2.jaxws.wrapper.impl.JAXBWrapperToolImpl.wrap(JAXBWrapperToolImpl.java:294)
at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMethodMarshaller.marshalResponse(DocLitWrappedMethodMarshaller.java:482)
... 33 more
答案 0 :(得分:0)
将WAS FP 8.5.5.10 升级为 8.5.5.12 后,我遇到了同样的问题。我们有两个具有完全相同的方法名称但不同的 targetNameSpace 的服务,例如DomainService1具有&#39; get&#39; 方法,DomainService2也具有&#39; get&#39; 方法,但WAS 8.5.5.12抛出此异常,并没有提供任何线索来查找根本原因。显然,WAS在最近版本中对方法的命名更为严格。
这是例外: org.apache.axis2.jaxws.wrapper.impl.JAXBWrapperException:发生内部断言错误。 com.xxx.web.myapp.services.jaxws.GetResponse JAXB对象没有xxxxxStatus xml
更改特定于每项服务的方法名称后,#get; getABC&#39;和&#39; getPQR&#39;它工作!!!
希望这有效!