需要帮助使用char参数测试Web服务方法

时间:2015-05-26 19:59:57

标签: jmeter

我试图使用JMeter 2.13来测试我的网络服务。我需要调用的方法之一有一个定义为char的参数。参数是性。

这是我的HTTP请求正文数据。

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:SaveDocument xmlns:ns2="http://oword.muhc.ca/">
         <DocumentID>0</DocumentID>
         <StatusCode>DRA</StatusCode>
         <TemplateID>17839</TemplateID>
         <Document>Testing save document.</Document>
         <PatientIDs>1172</PatientIDs>
         <Sex>F</Sex>
         <PatientFirstName>SUNNY</PatientFirstName>
         <PatientLastName>OCTOBER</PatientLastName>
         <ClassificationCode>0000</ClassificationCode>
         <OrderNumber></OrderNumber>
      </ns2:SaveDocument>
   </S:Body>
</S:Envelope>

这是我在JBoss日志中遇到的错误。

15:39:29,300 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
javax.xml.ws.WebServiceException: javax.xml.bind.UnmarshalException: For input string: "M"
 - with linked exception:
[java.lang.NumberFormatException: For input string: "M"]
    at org.jboss.ws.core.jaxws.JAXBDeserializer.handleUnmarshallException(JAXBDeserializer.java:112)
    at org.jboss.ws.core.jaxws.JAXBDeserializer.deserialize(JAXBDeserializer.java:80)
    at org.jboss.ws.core.binding.DeserializerSupport.deserialize(DeserializerSupport.java:60)
    at org.jboss.ws.core.soap.XMLContent.unmarshallObjectContents(XMLContent.java:181)
    at org.jboss.ws.core.soap.XMLContent.transitionTo(XMLContent.java:98)
    at org.jboss.ws.core.soap.SOAPContentElement.transitionTo(SOAPContentElement.java:140)
    at org.jboss.ws.core.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:171)
    at org.jboss.ws.core.EndpointInvocation.transformPayloadValue(EndpointInvocation.java:276)
    at org.jboss.ws.core.EndpointInvocation.getRequestParamValue(EndpointInvocation.java:118)
    at org.jboss.ws.core.EndpointInvocation.getRequestPayload(EndpointInvocation.java:138)
    at org.jboss.ws.core.server.DelegatingInvocation.getArgs(DelegatingInvocation.java:82)
    at org.jboss.wsf.container.jboss42.InvocationHandlerEJB3.invoke(InvocationHandlerEJB3.java:95)
    at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:223)
    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:421)
    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:286)
    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:196)
    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:122)
    at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:173)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
Caused by: javax.xml.bind.UnmarshalException: For input string: "M"
 - with linked exception:
[java.lang.NumberFormatException: For input string: "M"]
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:603)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:632)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:628)
    at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.handleParseConversionException(Loader.java:257)
    at com.sun.xml.bind.v2.runtime.unmarshaller.TextLoader.text(TextLoader.java:69)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.text(UnmarshallingContext.java:462)
    at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.text(InterningXmlVisitor.java:89)
    at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.processText(SAXConnector.java:168)
    at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.endElement(SAXConnector.java:141)
    at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:251)
    at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277)
    at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246)
    at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:123)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:314)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:293)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:244)
    at org.jboss.ws.core.jaxws.JAXBDeserializer.deserialize(JAXBDeserializer.java:73)
    ... 36 more
Caused by: java.lang.NumberFormatException: For input string: "M"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:449)
    at java.lang.Integer.valueOf(Integer.java:554)
    at com.sun.xml.bind.DatatypeConverterImpl._parseInt(DatatypeConverterImpl.java:104)
    at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$2.parse(RuntimeBuiltinLeafInfoImpl.java:244)
    at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$2.parse(RuntimeBuiltinLeafInfoImpl.java:246)
    at com.sun.xml.bind.v2.runtime.unmarshaller.TextLoader.text(TextLoader.java:65)
    ... 48 more
15:39:37,641 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
javax.xml.ws.WebServiceException: javax.xml.bind.UnmarshalException: For input string: "F"
 - with linked exception:
[java.lang.NumberFormatException: For input string: "F"]
    at org.jboss.ws.core.jaxws.JAXBDeserializer.handleUnmarshallException(JAXBDeserializer.java:112)
    at org.jboss.ws.core.jaxws.JAXBDeserializer.deserialize(JAXBDeserializer.java:80)
    at org.jboss.ws.core.binding.DeserializerSupport.deserialize(DeserializerSupport.java:60)
    at org.jboss.ws.core.soap.XMLContent.unmarshallObjectContents(XMLContent.java:181)
    at org.jboss.ws.core.soap.XMLContent.transitionTo(XMLContent.java:98)
    at org.jboss.ws.core.soap.SOAPContentElement.transitionTo(SOAPContentElement.java:140)
    at org.jboss.ws.core.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:171)
    at org.jboss.ws.core.EndpointInvocation.transformPayloadValue(EndpointInvocation.java:276)
    at org.jboss.ws.core.EndpointInvocation.getRequestParamValue(EndpointInvocation.java:118)
    at org.jboss.ws.core.EndpointInvocation.getRequestPayload(EndpointInvocation.java:138)
    at org.jboss.ws.core.server.DelegatingInvocation.getArgs(DelegatingInvocation.java:82)
    at org.jboss.wsf.container.jboss42.InvocationHandlerEJB3.invoke(InvocationHandlerEJB3.java:95)
    at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:223)
    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:421)
    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:286)
    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:196)
    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:122)
    at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:173)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
Caused by: javax.xml.bind.UnmarshalException: For input string: "F"
 - with linked exception:
[java.lang.NumberFormatException: For input string: "F"]
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:603)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:632)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:628)
    at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.handleParseConversionException(Loader.java:257)
    at com.sun.xml.bind.v2.runtime.unmarshaller.TextLoader.text(TextLoader.java:69)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.text(UnmarshallingContext.java:462)
    at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.text(InterningXmlVisitor.java:89)
    at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.processText(SAXConnector.java:168)
    at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.endElement(SAXConnector.java:141)
    at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:251)
    at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277)
    at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246)
    at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:123)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:314)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:293)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:244)
    at org.jboss.ws.core.jaxws.JAXBDeserializer.deserialize(JAXBDeserializer.java:73)
    ... 36 more
Caused by: java.lang.NumberFormatException: For input string: "F"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:449)
    at java.lang.Integer.valueOf(Integer.java:554)
    at com.sun.xml.bind.DatatypeConverterImpl._parseInt(DatatypeConverterImpl.java:104)
    at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$2.parse(RuntimeBuiltinLeafInfoImpl.java:244)
    at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$2.parse(RuntimeBuiltinLeafInfoImpl.java:246)
    at com.sun.xml.bind.v2.runtime.unmarshaller.TextLoader.text(TextLoader.java:65)
    ... 48 more

我该怎样做才能调用此方法?

谢谢!

1 个答案:

答案 0 :(得分:0)

使用Unicode值作为整数而不是字符M或F. 对于字符M(男性)使用77,对于字符F(女性)使用70

所以看起来应该是这样的 77或 70

希望得到这个帮助。