在java中使用webservice时出错

时间:2013-05-21 09:32:57

标签: java xml web-services

您好我正在使用java调用Web服务,但收到以下错误:

  SEVERE: Exception:
org.xml.sax.SAXException: Invalid element in iseries.wsbeans.createbiditem.xsd.CreateBidItemResponse - BidItem
    at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:258)
    at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
    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 p6devc01.p6devc.service.basicsite.services.soap.CreateBidItemSoapBindingStub.createBidItem(CreateBidItemSoapBindingStub.java:192)
    at p6devc01.p6devc.service.basicsite.services.soap.CreateBidItemPortTypeProxy.createBidItem(CreateBidItemPortTypeProxy.java:50)
    at stocklistCreateBid.test.createBidItem(test.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
    at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
    at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
    at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
    at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

当我从SoapUI调用web服务时,它没有问题..这里是错误提到的xsd文件:

  <?xml version="1.0" encoding="utf-8" ?> 
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://createbiditem.wsbeans.iseries/xsd" elementFormDefault="qualified" attributeFormDefault="unqualified">
- <xs:element name="CreateBidItemRequest">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="Input" minOccurs="1" maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="Log" minOccurs="1" maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
  <xs:element name="LogKey" type="xs:string" minOccurs="1" maxOccurs="1" /> 
  <xs:element name="UserId" type="xs:string" minOccurs="1" maxOccurs="1" /> 
  </xs:sequence>
  </xs:complexType>
  </xs:element>
- <xs:element name="Input" minOccurs="1" maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
  <xs:element name="BIDOperationsItemId" type="xs:string" minOccurs="1" maxOccurs="1" /> 
  <xs:element name="BidPriceGroupOperationsItemId" type="xs:string" minOccurs="1" maxOccurs="1" /> 
  <xs:element name="CustomerBidNumber" type="xs:string" minOccurs="1" maxOccurs="1" /> 
  <xs:element name="OperationsItemSubTypeCode" type="xs:string" minOccurs="1" maxOccurs="1" /> 
  <xs:element name="StockOrderGroup" type="xs:string" minOccurs="1" maxOccurs="1" /> 
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  </xs:sequence>
  </xs:complexType>
  </xs:element>
- <xs:element name="CreateBidItemResponse">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="BidItem" minOccurs="1" maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
  <xs:element name="BidItemKnownBy" type="xs:string" minOccurs="1" maxOccurs="1" /> 
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  </xs:schema>

错误告诉我它与响应元素有关但无效但是什么? 为什么会发生这种情况,为什么它在soapUI而不是java中工作? 谢谢

1 个答案:

答案 0 :(得分:0)

我已经重新创建了webservice,它现在似乎正在运行。不知道为什么它在SoapUI中起作用但是谢谢你。