13

Using the following sample WSDL file, I've generated a new project in SOAP UI (version 3.5), and created the example test suite, test case, and mock service.

WSDL

<definitions name="HelloService"
   targetNamespace="http://www.examples.com/wsdl/HelloService.wsdl"
   xmlns="http://schemas.xmlsoap.org/wsdl/"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:tns="http://www.examples.com/wsdl/HelloService.wsdl"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <message name="SayHelloRequest">
      <part name="firstName" type="xsd:string"/>
   </message>
   <message name="SayHelloResponse">
      <part name="greeting" type="xsd:string"/>
   </message>

   <portType name="Hello_PortType">
      <operation name="sayHello">
         <input message="tns:SayHelloRequest"/>
         <output message="tns:SayHelloResponse"/>
      </operation>
   </portType>

   <binding name="Hello_Binding" type="tns:Hello_PortType">
   <soap:binding style="rpc"
      transport="http://schemas.xmlsoap.org/soap/http"/>
   <operation name="sayHello">
      <soap:operation soapAction="sayHello"/>
      <input>
         <soap:body
            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
            namespace="urn:examples:helloservice"
            use="encoded"/>
      </input>
      <output>
         <soap:body
            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
            namespace="urn:examples:helloservice"
            use="encoded"/>
      </output>
   </operation>
   </binding>

   <service name="Hello_Service">
      <documentation>WSDL File for HelloService</documentation>
      <port binding="tns:Hello_Binding" name="Hello_Port">
         <soap:address
            location="http://www.examples.com/SayHello/"/>
      </port>
   </service>
</definitions>

I can start up the mock service and access via the browser, whereby I see a link to the wsdl and can view it.

However, by using the default generated soap request (as follows), it returns an html response (appears to be the web page) rather than the soap response I have configured.

REQUEST

POST http://localhost:8088/SayHello/ HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "sayHello"
User-Agent: Jakarta Commons-HttpClient/3.1
Host: localhost:8088
Content-Length: 467

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:examples:helloservice">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:sayHello soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <firstName xsi:type="xsd:string">James</firstName>
      </urn:sayHello>
   </soapenv:Body>
</soapenv:Envelope>

RESPONSE

HTTP/1.1 200 OK
Content-Type: text/html; charset=iso-8859-1
Transfer-Encoding: chunked
Server: Jetty(6.1.x)

<html><body><p>There are currently 1 running soapUI MockServices</p><ul><li><a href="/mockHello_Binding?WSDL">Hello_Binding MockService</a></li></ul></p></body></html>

I've configured a sample response as follows :

SAMPLE RESPONSE ON MOCK

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:examples:helloservice">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:sayHelloResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <greeting xsi:type="xsd:string">?</greeting>
      </urn:sayHelloResponse>
   </soapenv:Body>
</soapenv:Envelope>

Its configured as the default response, so I have no idea why it is not being returned.

Any suggestions? +1's to anything that helps me progress this.

Thanks

Jimmy
  • 16,123
  • 39
  • 133
  • 213

5 Answers5

15

No service is started for the endpoint URL from your request: http://localhost:8088/SayHello/. The only started service is located at URL http://localhost:8088/mockHello_Binding as reported in the service response. SoapUI returns list of all started mock services in HTML page when a non-existed one is requested. Consider fixing endpoint address to resolve this issue.

Artem Zankovich
  • 2,319
  • 20
  • 36
6

I have hit the same problem using soap ui 5.4.0. It have happend beacuse the path of created mock service was incorrect.

If you click in the soap UI, on the created mock service - properties button on the bottom - you will see that your path looks like /mockBindingservice, it should say /.

To change it, double click on the created mock service, click stop service than settings button (located next to stop and start buttons).Change Path to / and double check host.

Save, start service. Should work now.

I know it is an old post, but hopefully it will help sombody looking for the anwser.

autumn_witch
  • 61
  • 1
  • 2
  • Please finish the tour. Good you posted your soap version number with your answer. This way it keeps a little... up to date ;-) – ZF007 Jan 17 '18 at 10:25
  • You sir are a legend. I was using wireshark and still couldn't tell why SOAPUI wasn't responding properly to my REST request. Turned out I needed the Path (in REST MockService Options) set to /, and only the Resource Path set for the mock action. Previously I had both set to the same thing. – Daniel Jul 04 '18 at 06:22
1

The Url you are hitting is incorrect. The MockService URL is created while you import the WSDL to SOAP with default port 8088. Solution: 1)Create new Project 2)Import WSDL 3)Check Create Mockervice 4)Then you will SEE the URL where mockservice will run::-->mockSearchURL(for eg) 5)hit HTTP://{IP}:8088/mockSearchURL

DONE!!

Jaymin
  • 2,879
  • 3
  • 19
  • 35
Sidak
  • 29
  • 2
  • 10
0

i think is the name in Url and the name in request

Url : SayHello Request : sayHello S and s

name should be matched

Ali Gaber
  • 1
  • 2
-1

I has similar issue with BizTalk 2010 Send Port and Mock SOAPUI webservice. I found out that the 2 URL er different When I open this in IE..I see the HTML response. http://localhost:8088/MockUpdateBasicHttp

When you opened this in IE I got a blank white screen which normally means success. http://localhost:8088//MockUpdateBasicHttp

The correct URL is with a single '/' after port number. http://localhost:8088/MockUpdateBasicHttp