작업, 끝점 및 예제 페이로드를 얻기 위해 WSDL을 구문 분석하려고합니다. 사용자가 입력 한 WSDL입니다. 이 작업을 수행하는 데 필요한 자습서를 찾을 수 없습니다.WSDL을 파싱하는 간단한 방법
내가 필요로하지 않는 소스 코드를 생성하는 소스 만 찾을 수 있습니다. XBeans를 사용해 보았지만 분명히 Saxon이 필요합니다. Saxon 없이는 이것을 할 수있는 간단한 방법이 있습니까?
예.
<?xml version="1.0"?>
<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://example.com/stockquote"/>
</port>
</service>
</definitions>
는 작업을 얻을해야 : GetLastTradePrice,
엔드 포인트 GetLastTradePrice
: StockQuotePort샘플 페이로드 :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:stoc="http://example.com/stockquote.xsd">
<soapenv:Header/>
<soapenv:Body>
<stoc:TradePriceRequest/>
</soapenv:Body>
</soapenv:Envelope>
이 SoapUI가하는 일 같다. 하지만 주로 WSDL을 파싱 할 수 있는지에 관심이 있습니다. WSDL이 업로드되고 GWT 응용 프로그램에 결과가 표시됩니다 (파일 업로드는 서블릿으로 이동해야합니다). 그래서 파일을 파싱하고 GWT가 이해할 수있는 객체를 만들어야합니다.
예를 들어 wsdl 있으십니까? –
wsdl은 XML 파서를 사용하여 구문 분석하여 필요한 것을 얻을 수 있습니다. SAX는 매우 가볍고 배우기 쉽습니다. http://stackoverflow.com/questions/2134507/fast-lightweight-xml-parser – Pedantic
트릭을 수행 할 수있는 라이브러리를 찾는 것처럼 보입니다. SOAPUI에는 재사용 할 수있는 라이브러리가 있습니다. jar/class 이름은 기억이 나지 않지만 1 년 전 successfuly했습니다. – Abhilash