Mule在http端点上创建wsdl

时间:2012-10-19 17:14:28

标签: http wsdl esb mule

我想知道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>

感谢您的时间。

1 个答案:

答案 0 :(得分: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注释。