qileilove

          blog已經(jīng)轉(zhuǎn)移至github,大家請(qǐng)?jiān)L問(wèn) http://qaseven.github.io/

          soapUI的Mocservice仿真測(cè)試問(wèn)題

           最近做一個(gè)項(xiàng)目,使用了WEBService,但是這個(gè)接口是別人提供的并且沒(méi)有完成,但是WSDL給提供了.
            想使用SOAPUI的MOCKSERVICE功能模擬一個(gè)WEBService.
            首先用AXIS做了一個(gè)WEBService,用以下代碼進(jìn)行測(cè)試OK,但訪問(wèn)SOAPUI做的MOCKSERVICE失敗,
            想向各位高手確認(rèn)下,SOAPUI的MOCKSERVICE能做為一WEBService讓JAVA程序訪問(wèn)嗎?
            JAVA WEBclient代碼如下:
          Java code?123456789101112131415161718192021222324252627  // String endpoint = "http://localhost:8080/axis/Hello.jws?wsdl";                      String endpoint = "http://localhost:8088/axis/Hello.jws?WSDL";                                            
          Service service = new Service();                        
          Call call = (Call) service.createCall();                        
          call.setTargetEndpointAddress(endpoint);                                             
          call.setOperationName("hello");                      
          call.setSOAPVersion(SOAPConstants.SOAP11_CONSTANTS);                      
          call.addParameter("name", org.apache.axis.encoding.XMLType.XSD_STRING,  javax.xml.rpc.ParameterMode.IN); //                     call.addParameter("ToCurrency", org.apache.axis.encoding.XMLType.XSD_STRING, // //                             javax.xml.rpc.ParameterMode.IN);                        
          call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);                                                  
          Object result = call.invoke(new Object[]{"JPY"});                                             
          System.out.println("result is "+result.toString());
          SOAPUI的HTTP LOG如下:
          Sun Aug 26 23:18:36 JST 2012:DEBUG:HelloSoapBinding MockService was unable to dispatch mock request
          com.eviware.soapui.impl.wsdl.mock.DispatchException: Missing operation for soapAction [] and body element [hello] with SOAP Version [SOAP 1.1]
          at com.eviware.soapui.impl.wsdl.support.soap.SoapUtils.findOperationForRequest(SoapUtils.java:353)
          at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchPostRequest(WsdlMockRunner.java:260)
          at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchRequest(WsdlMockRunner.java:383)
          at com.eviware.soapui.monitor.JettyMockEngine$ServerHandler.handle(JettyMockEngine.java:701)
          at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
          at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
          at org.mortbay.jetty.Server.handle(Server.java:326)
          at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
          at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
          at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
          at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
          at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
          at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
          at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
          Sun Aug 26 23:18:36 JST 2012:ERROR:An error occured [Missing operation for soapAction [] and body element [hello] with SOAP Version [SOAP 1.1]], see error log for details
           JAVA的錯(cuò)誤代碼如下:
          - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
          AxisFault
          faultCode: {http://xml.apache.org/axis/}HTTP
          faultSubcode:
          faultString: (500)Internal Server Error
          faultActor:
          faultNode:
          faultDetail:
          {}:return code:  500
          <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
          <soapenv:Body>
          <soapenv:Fault>
          <faultcode>Server</faultcode>
          <faultstring>Missing operation for soapAction [] and body element [hello] with SOAP Version [SOAP 1.1]</faultstring>
          </soapenv:Fault>
          </soapenv:Body>
          </soapenv:Envelope>
          {http://xml.apache.org/axis/}HttpErrorCode:500
          (500)Internal Server Error
          at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
          at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
          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.client.AxisClient.invoke(AxisClient.java:165)
          at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
          at org.apache.axis.client.Call.invoke(Call.java:2767)
          at org.apache.axis.client.Call.invoke(Call.java:2443)
          at org.apache.axis.client.Call.invoke(Call.java:2366)
          at org.apache.axis.client.Call.invoke(Call.java:1812)
          at WebServiceClient.main(WebServiceClient.java:51)
          (500)Internal Server Error
            用JAVA訪問(wèn)AXIS的WEBSERVICE的OK結(jié)果如下:
          - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
          result is Hello JPY

          posted on 2014-10-30 11:23 順其自然EVO 閱讀(1203) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): 測(cè)試學(xué)習(xí)專(zhuān)欄

          <2014年10月>
          2829301234
          567891011
          12131415161718
          19202122232425
          2627282930311
          2345678

          導(dǎo)航

          統(tǒng)計(jì)

          常用鏈接

          留言簿(55)

          隨筆分類(lèi)

          隨筆檔案

          文章分類(lèi)

          文章檔案

          搜索

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 沛县| 裕民县| 天长市| 法库县| 临朐县| 阳新县| 沽源县| 栾城县| 罗城| 增城市| 手游| 乐亭县| 宁河县| 松阳县| 滨州市| 疏勒县| 包头市| 新化县| 娄底市| 开平市| 高州市| 通化县| 吉木萨尔县| 湖南省| 都昌县| 锦州市| 深水埗区| 高雄县| 武冈市| 安新县| 永德县| 太仓市| 甘孜县| 承德市| 龙州县| 阿拉善右旗| 榕江县| 出国| 河西区| 公主岭市| 秭归县|