Resteasy client problems
magick93 Dec 12, 2014 7:54 PMHi guys
Im trying to create a simple REST client in SY. Can anyone help identify what I am doing wrong?
I am getting the following error:
[ERROR] Failed to execute goal org.switchyard:switchyard-plugin:2.0.0.Alpha3:configure (default) on project svs.kreator: SWITCHYARD011602: Model [org.switchyard.config.model.switchyard.v1.V1SwitchYardModel] is invalid: cvc-complex-type.2.4.a: Invalid content was found starting with element 'trfm:transform.json'. One of '{"urn:switchyard-config:switchyard:2.0":transforms, "urn:switchyard-config:switchyard:2.0":validates, "urn:switchyard-config:switchyard:2.0":domain, "urn:switchyard-config:switchyard:2.0":artifacts}' is expected. -> [Help 1]
And here is my switchyard.xml file:
<?xml version="1.0" encoding="UTF-8"?> <sy:switchyard xmlns:bean="urn:switchyard-component-bean:config:2.0" xmlns:trfm="urn:switchyard-config:transform:2.0" xmlns:resteasy="urn:switchyard-component-resteasy:config:2.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:sy="urn:switchyard-config:switchyard:2.0" name="svs.kreator" targetNamespace="urn:com.domain:svs.kreator:1.0"> <sca:composite name="svs.kreator" targetNamespace="urn:com.domain:svs.kreator:1.0"> <sca:component name="MyAccountService"> <bean:implementation.bean class="com.domain.svs.kreator.MyAccountServiceBean"/> <sca:service name="MyAccountService"> <sca:interface.java interface="com.domain.svs.kreator.MyAccountService"/> </sca:service> <sca:reference name="SvsResource"> <sca:interface.java interface="com.domain.svs.kreator.SvsResource"/> </sca:reference> </sca:component> <sca:reference name="SvsAccountReference" multiplicity="0..1" promote="MyAccountService/SvsResource"> <sca:interface.java interface="com.domain.svs.kreator.SvsAccountClient"/> <resteasy:binding.rest name="rest1"> <resteasy:interfaces>com.domain.svs.kreator.SvsResource</resteasy:interfaces> <resteasy:address>https://www.myserviceprovider.com/en/index.php</resteasy:address> </resteasy:binding.rest> </sca:reference> </sca:composite> <trfm:transform.json from="java:com.domain.svs.kreator.SvsAccount" to="{urn:com.domain:svs.kreator:1.0}svsAccount"/> </sy:switchyard>
Note, if I do not include the transformation tags in the xml, then I get the following errors:
Caused by: org.jboss.resteasy.client.exception.ResteasyClientException: Unexpected exception type
at org.jboss.resteasy.client.exception.mapper.ApacheHttpClient4ExceptionMapper.toException(ApacheHttpClient4ExceptionMapper.java:73)
at org.jboss.resteasy.client.exception.mapper.ApacheHttpClient4ExceptionMapper.toException(ApacheHttpClient4ExceptionMapper.java:59)
at org.switchyard.component.resteasy.util.ClientInvoker.invoke(ClientInvoker.java:341)
at org.switchyard.component.resteasy.OutboundHandler.handleMessage(OutboundHandler.java:144)
... 119 more
Caused by: java.lang.RuntimeException: could not find writer for content-type application/json type: com.domain.svs.kreator.SvsAccount
at org.jboss.resteasy.client.ClientRequest.writeRequestBody(ClientRequest.java:470)
at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.writeRequestBodyToOutputStream(ApacheHttpClient4Executor.java:393)
at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.buildEntity(ApacheHttpClient4Executor.java:360)
at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.loadHttpMethod(ApacheHttpClient4Executor.java:332)
at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.execute(ApacheHttpClient4Executor.java:180)
at org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:39)
at org.jboss.resteasy.plugins.interceptors.encoding.AcceptEncodingGZIPInterceptor.execute(AcceptEncodingGZIPInterceptor.java:40)
at org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:45)
at org.jboss.resteasy.client.ClientRequest.execute(ClientRequest.java:444)
at org.jboss.resteasy.client.ClientRequest.httpMethod(ClientRequest.java:688)
at org.switchyard.component.resteasy.util.ClientInvoker.invoke(ClientInvoker.java:335)
... 120 more