When I ran the example http-binding in ServiceMix2.0 release I got the "Bad
endPoint type (endPoint instance of URL)" .
I copy the configuration to ServiceMix3.0
<sm:activationSpec componentName="httpReceiver"
service="foo:httpBinding"
endpoint="httpReceiver"
destinationService="foo:stockQuote">
<sm:component>
<bean xmlns="http://xbean.org/schemas/spring/1.0"
class="org.servicemix.components.http.HttpConnector">
<property name="host" value="localhost"/>
<property name="port" value="8912"/>
</bean>
</sm:component>
</sm:activationSpec>
<!-- This just invokes another service -->
<sm:activationSpec componentName="stockQuote"
service="foo:stockQuote"
endpoint="stockQuote">
<sm:component>
<bean xmlns="http://xbean.org/schemas/spring/1.0"
class="org.servicemix.components.saaj.SaajBinding">
<property name="soapEndpoint">
<bean class="javax.xml.messaging.URLEndpoint">
constructor-arg value="http://64.124.140.30/soap"/>
</bean>
</property>
</bean>
</sm:component>
</sm:activationSpec>
But it doesnt work either.
At last I replaced "http://64.124.140.30/soap"
,"org.servicemix.components.saaj.SaajBinding" with
"http://localhost:8080/axis/services/ObjectService" , "OwnerStockQuote", It
is extends SaajBinding and override the method "transform"
there is the code :
protected boolean transform(MessageExchange exchange, NormalizedMessage in,
NormalizedMessage out) throws Exception {
SOAPConnection connection =
getConnectionFactory().createConnection();
try {
SOAPMessage inMessage = getMarshaler().createSOAPMessage(in);
MimeHeaders mh = inMessage.getMimeHeaders();
if (mh.getHeader("SOAPAction") == null) {
if (getSoapAction() != null && getSoapAction().length() > 0)
{
mh.addHeader("SOAPAction", getSoapAction());
} else {
mh.addHeader("SOAPAction", "\"\"");
}
inMessage.saveChanges();
}
/*if (log.isDebugEnabled()) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
inMessage.writeTo(buffer);
log.debug(new String(buffer.toByteArray()));
}*/
//System.out.println(inMessage);
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
inMessage.writeTo(buffer);
String str = new String(buffer.toByteArray());
//str = str.replaceAll()
System.out.println(new String(buffer.toByteArray()));
InputStream input = new StringBufferInputStream(str);
//axis
SOAPEnvelope en = new SOAPEnvelope(input);
Service service = new Service();
//registerType
registerAxisType(service);
Call call = (Call) service.createCall();
//new QName("http://www.w3.org/2001/XMLSchema", "Input")
call.addParameter("str", XMLType.SOAP_DOCUMENT,
ParameterMode.INOUT);
call.setReturnType(XMLType.SOAP_DOCUMENT);
javax.xml.messaging.URLEndpoint se =
(javax.xml.messaging.URLEndpoint)getSoapEndpoint();
call.setTargetEndpointAddress(se.getURL());
SOAPEnvelope enve = (SOAPEnvelope)call.invoke(en);
System.out.println(enve);
SOAPMessage response =
getMarshaler().getMessageFactory().createMessage(new MimeHeaders(), new
StringBufferInputStream(enve.getAsString()));
//SOAPMessage response = connection.call(inMessage,
getSoapEndpoint());
if (response != null) {
getMarshaler().toNMS(out, response);
return true;
} else {
return false;
}
}
finally {
try {
connection.close();
}
catch (SOAPException e) {
e.printStackTrace();
// log.warn("Failed to close connection: " + e, e);
}
}
}
}
It works well;
But I used axis as client to invoke web service.It smells bad.Is there easy
way to invoke anthor service use ServiceMix api?
Thanks
--
View this message in context:
http://www.nabble.com/Bad-endpoint-type-with-http-binding-tf2423269.html#a6755932
Sent from the ServiceMix - User mailing list archive at Nabble.com.