Reputation: 708
This is my mule flow:
HTTP => Logger => SOAP (CXF) => Until Successful [JAVA] => LOGGER
Spring :
<spring:beans>
<spring:bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<spring:property name="locations">
<spring:list>
<spring:value>test.properties</spring:value>
</spring:list>
</spring:property>
</spring:bean>
<spring:bean id="testIntegration"
class="x.x.x.IntegrationClass" init-method="init">
<spring:property name="url" value="${destiny.url}" />
<spring:property name="username" value="${message.username}" />
<spring:property name="password" value="${message.password}" />
</spring:bean>
</spring:beans>
Flow:
<http:inbound-endpoint exchange-pattern="request-response"
host="localhost" port="8087" doc:name="HTTP" />
<logger message="#[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>
<cxf:jaxws-service doc:name="Test service"
serviceClass="dynamics.file.request.Requests" />
<until-successful maxRetries="3"
secondsBetweenRetries="60" doc:name="Until Successful" synchronous="true">
<component doc:name="Java">
<spring-object bean="testIntegration" />
</component>
</until-successful>
<logger message="#[message.payloadAs(java.lang.String)]" level="INFO"
doc:name="Logger" />
</flow>
The Java component returns a String (XML but String) and when I use until-successful
it shows me this error:
Exception thrown inside until-successful org.mule.component.ComponentException: Component that caused exception is: DefaultJavaComponent{Flow_test.component.1805940825}. Message payload is of type: String
[[test_flow].connector.http.mule.default.receiver.02] org.mule.exception.DefaultSystemExceptionStrategy:
********************************************************************************
Message : Failed to find entry point for component, the following resolvers tried but failed: [
MethodHeaderPropertyEntryPointResolver: The required property "method" is not set on the event
CallableEntryPointResolver: Object "es.test.integration.testIntegration@4eb6b10c" does not implement required interface "interface org.mule.api.lifecycle.Callable"
ReflectionEntryPointResolver: Found too many possible methods on object "es.test.integration.testIntegration" that accept parameters "{class java.lang.String}", Methods matched are "[public java.lang.String es.test.integration.testIntegration.cte(java.lang.String), public java.lang.String es.test.integration.testIntegration.cancelCte(java.lang.String), public java.lang.String es.test.integration.testIntegration.newCte(java.lang.String), public java.lang.String es.test.integration.testIntegration.totalCte(java.lang.String), public java.lang.String es.test.integration.testIntegration.resultCte(java.lang.String), public java.lang.String es.test.integration.testIntegration.newCte(java.lang.String), public java.lang.String es.test.integration.testIntegration.cteAll(java.lang.String)]"
AnnotatedEntryPointResolver: Component: es.test.integration.testIntegration@4eb6b10c doesn't have any annotated methods, skipping.
]
Code : MULE_ERROR-321
at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:49)
at org.mule.component.DefaultComponentLifecycleAdapter.invoke(DefaultComponentLifecycleAdapter.java:339)
at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:82)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
Message : Software caused connection abort: socket write error (java.net.SocketException)
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Software caused connection abort: socket write error (java.net.SocketException)
java.net.SocketOutputStream:-2 (null)
2. Software caused connection abort: socket write error (java.net.SocketException) (org.mule.api.DefaultMuleException)
org.mule.transport.http.HttpMessageProcessTemplate:170 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/DefaultMuleException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.net.SocketException: Software caused connection abort: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
With that error I suppose that I need any parameters here but correct me if I'm wrong:
public void init()
{
NtlmAuthenticator authenticator = new NtlmAuthenticator(username,password);
Authenticator.setDefault(authenticator);
Requestsservice = new Requests();
clntprt = service.getSolicitudesPort();
Client client = ClientProxy.getClient(cliente);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setAllowChunking(false);
http.setClient(httpClientPolicy);
BindingProvider provider = (BindingProvider) clntprt;
provider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
url);
}
Updated:
Where I have the init method I have the implemented methods (These both for example, but there are more):
@WebMethod(operationName = "CancelCte", action = "urn:microsoft-dynamics-schemas/codeunit/Requests:CancelCte")
@RequestWrapper(localName = "CancelCte", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests", className = "x.x.Requests.CancelCte")
@ResponseWrapper(localName = "CancelCte_Result", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests", className = "x.x.Requests.CancelCteResult")
@WebResult(name = "return_value", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests")
public String CancelCte(
@WebParam(name = "xmlInput", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests") String xmlInput)
{
return client.CancelCte(xmlInput);
}
@WebMethod(operationName = "newCte", action = "urn:microsoft-dynamics-schemas/codeunit/Requests:newCte")
@RequestWrapper(localName = "newCte", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests", className = "x.x.Requests.newCte")
@ResponseWrapper(localName = "newCte_Result", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests", className = "x.x.Requests.newCteResult")
@WebResult(name = "return_value", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests")
public String newCte(
@WebParam(name = "xmlInput", targetNamespace = "urn:microsoft-dynamics-schemas/codeunit/Requests") String xmlInput)
{
return client.newCte(xmlInput);
}
Like now, automatically use the necessary method.
Upvotes: 0
Views: 1410
Reputation: 33413
With the partial information you have provided, all I can say is that the source of the problem is located in:
<spring-object bean="testIntegration" />
based on: Component that caused exception is: DefaultJavaComponent{Flow_test.component.1805940825}
The main issue is that Mule can't locate a method to call on your custom component: there are two many methods of arity 1 that take String
, which prevent Mule to pick an appropriate "entry point". Two solutions to fix this:
method
with the method name to call as its value before the call to the component,invoke
message processor to call the desired method directly.As a side note, it seems this component performs outbound HTTP calls: typically you want to use Mule HTTP to do this instead of doing it in custom code. First you're burying these interactions inside custom code: someone looking at the Mule config won't know that outbound HTTP call are involved. Moreover, Mule itself will not know so it can't do anything like general lifecycle and error management, stats... on these custom HTTP calls.
Upvotes: 1