1
votes

I am having pretty basic issues configuring a Web Service Consumer that I am hoping someone can assist with.

I am using Anypoint Studio March 2015 Release Version: 5.1.2 Build Id: 201504301511 on Windows Vista

The WSDL for the service I am trying to consume is

<definitions name="StockQuote" targetNamespace="http://example.com/stockquote.wsdl" xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">
  <types>
    <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2000/10/XMLSchema">
      <element name="TradePriceRequest">
        <complexType>
          <all>
            <element name="tickerSymbol" type="string"/>
          </all>
        </complexType>
      </element>
      <element name="TradePrice">
        <complexType>
          <all>
            <element name="price" type="float"/>
          </all>
        </complexType>
      </element>
    </schema>
  </types>
  <message name="GetLastTradePriceInput">
    <part name="body" element="xsd1:TradePriceRequest"/>
  </message>
  <message name="GetLastTradePriceOutput">
    <part name="body" element="xsd1:TradePrice"/>
  </message>
  <portType name="StockQuotePortType">
    <operation name="GetLastTradePrice">
      <input message="tns:GetLastTradePriceInput"/>
      <output message="tns:GetLastTradePriceOutput"/>
    </operation>
  </portType>
  <binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="GetLastTradePrice">
      <soap:operation soapAction="http://example.com/GetLastTradePrice"/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>
  <service name="StockQuoteService">
    <documentation>My first service</documentation>
    <port name="StockQuotePort" binding="tns:StockQuoteBinding">
      <soap:address location="http://localhost:8080/"/>
    </port>
  </service>
</definitions>

It is a copy of a example from the W3C site with only the soap address modified.

First issue I encounter is that, after successfully importing the WDL file into my mule project, I cannot use the file Global Element Property window to populate the WDSL Location text box using the file browsing 'button'.

Clicking the file browsing button successfully lists all the *.wsdl files in my mule project but selecting any of them does not populate the WSDL Location text box.

Manually entering the file path to the wsdl in the project appears to recognise the wsdl. It no longer reports a missing wsdl location attribute and it automatically populates the Service text box from the service definition in the wsdl (StockQuoteService). However the Port (and address) drop-down lists are not populated from the WSDL entries.

Manually entering the Port (StockQuotePort) automatically populates the address text box from the WSDL but it reports an error "Web Service Consumer supports only Ports with SOAP Body".

Any help would be appreciated.

1
Yup, I get the same issue, however you could try with this tshirt-service.cloudhub.io/?wsdl .... I am wondering if the WS Consumer only works with hosted wsdl's at this point ...Sudarshan

1 Answers

1
votes

ws-consumer does work with local WSDLs as well and works for me on a Mac using:

Anypoint Studio March 2015 Release
Version: 5.1.1
Build Id: 201504011500

Maybe a bug with the Windows Studio distribution. But alternatively can you switch to the XML view and edit the ws-consumer-config to just read the WSDL from the classpath:

    <ws:consumer-config name="Web_Service_Consumer1"
        wsdlLocation="MyLocalWsdl.wsdl" service="ImportV200606" port="ImportV200606Soap"
        serviceAddress="https://MyLocalService/service.svc?responseTimeout=280000"
        doc:name="Web Service Consumer">
    </ws:consumer-config>