1

我想知道 Mule 是否会在 http 端点上创建一个 wsdl,以便我可以通过soapUI 访问它。我用肥皂信封传入 xml,如下所示。我没有创建 wsdl,但之后我有一个流程来读取和使用传入的这个 xml。我知道使用其他 ESB 工具可以说这个端点需要公开一个 wsdl,它会为你在构建。骡子会这样做吗?

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
    <lookup>
        <bookid>0028634748</bookid>
    </lookup>
</soapenv:Body>

谢谢你的时间。

4

1 回答 1

1

Mule 可以即时生成 WSDL,但它需要一些东西来推断 WSDL。它可以从纯 POJO 组件中完成,而无需 JAX-WS 注释,并且配置如下:

<flow name="bookLookupService">
    <http:inbound-endpoint address="http://localhost:8181/bls"
        exchange-pattern="request-response">
        <cxf:simple-service serviceClass="com.acme.BookLookupService" />
    </http:inbound-endpoint>
    <component class="com.acme.BookLookupServiceImpl" />
</flow>

使用以下界面:

package com.acme;

public interface BookLookupService
{
    public static class BookLookup
    {
        private String bookid;

        public String getBookid()
        {
            return bookid;
        }

        public void setBookid(final String bookid)
        {
            this.bookid = bookid;
        }
    }

    public static class Book
    {
        private String bookid, name;

        public String getBookid()
        {
            return bookid;
        }

        public void setBookid(final String bookid)
        {
            this.bookid = bookid;
        }

        public String getName()
        {
            return name;
        }

        public void setName(final String name)
        {
            this.name = name;
        }
    }

    Book lookup(final BookLookup bookLookup);
}

和实施:

package com.acme;

public class BookLookupServiceImpl implements BookLookupService
{
    public Book lookup(final BookLookup bookLookup)
    {
        final Book book = new Book();
        book.setName("LOTR");
        book.setBookid(bookLookup.getBookid());
        return book;
    }
}

问题是 WSDL 将不符合上面的预期消息,您最终会得到如下消息:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:acme="http://acme.com/" xmlns:acme1="http://acme.com">
   <soapenv:Header/>
   <soapenv:Body>
      <acme:lookup>
         <acme:arg0>
            <acme1:bookid>ABC123</acme1:bookid>
         </acme:arg0>
      </acme:lookup>
   </soapenv:Body>
</soapenv:Envelope>

如果您想对生成的 WSDL 进行更严格的控制,则必须使用 JAX-WS / JAXB 注释。

于 2012-10-19T17:52:28.747 回答