0
A 2 CXF-2.5.0ダイナミッククライアントを呼び出すようにしようとはして失敗します。CXFの動的クライアントを2つ呼び出す方法は?
org.apache.cxf.interceptor.Fault: Marshalling Error: net.webservicex.GetWeather is not known to this context
package my.test;
import javax.xml.namespace.QName;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
public class TwoDynClients {
public static void main(String[] args) throws Exception {
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
Client clientA = dcf.createClient("http://www.webservicex.net/stockquote.asmx?WSDL");
Object[] resultA = clientA.invoke(new QName("http://www.webserviceX.NET/", "GetQuote"), "GOOG");
System.out.println("resultA: " + resultA[0]);
Client clientB = dcf.createClient("http://www.webservicex.net/GlobalWeather.asmx?wsdl");
Object[] resultB = clientB.invoke(new QName("http://www.webserviceX.NET", "GetWeather"), new Object[] {"Stuttgart", "Germany"});
System.out.println("resultB: " + resultB[0]);
}
}
上記のスニペットの出力は次のとおりです。
29.12.2011 9:37:12 org.apache.cxf.jaxb.JAXBUtils logGeneratedClassNames
INFO: Created classes: net.webservicex.GetQuote, net.webservicex.GetQuoteResponse, net.webservicex.ObjectFactory
resultA: <StockQuotes><Stock><Symbol>GOOG</Symbol><Last>639.70</Last><Date>12/28/2011</Date><Time>4:00pm</Time><Change>0.00</Change><Open>N/A</Open><High>N/A</High><Low>N/A</Low><Volume>0</Volume><MktCap>207.2B</MktCap><PreviousClose>639.70</PreviousClose><PercentageChange>0.00%</PercentageChange><AnnRange>473.02 - 645.00</AnnRange><Earns>29.337</Earns><P-E>21.81</P-E><Name>Google Inc.</Name></Stock></StockQuotes>
29.12.2011 9:37:22 org.apache.cxf.jaxb.JAXBUtils logGeneratedClassNames
INFO: Created classes: net.webservicex.GetCitiesByCountry, net.webservicex.GetCitiesByCountryResponse, net.webservicex.GetWeather, net.webservicex.GetWeatherResponse, net.webservicex.ObjectFactory
29.12.2011 9:37:24 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Interceptor for {http://www.webserviceX.NET}GlobalWeather#{http://www.webserviceX.NET}GetWeather has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Marshalling Error: net.webservicex.GetWeather is not known to this context
at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:261)
- クライアントの順序が変更された場合秒は失敗する。
- 1つのJaxWsDynamicClientFactoryを使用して両方のクライアントを作成しても問題ありませんか?ダニエルKulpから