Grails + CXF + MTOM + Contract-first causes MIME boundary problems

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

Grails + CXF + MTOM + Contract-first causes MIME boundary problems

rsom@certifydatasystems.com
I'm trying to create an endpoint using Grails + CXF. There is a WSDL that is provided by a standards body, and I have to use that as the contract for the web service.
When I use JAXB to codegen from the WSDL, I get a class that looks like this:

public class ProvideAndRegisterDocumentSetRequestType {
    ...
    protected List<ProvideAndRegisterDocumentSetRequestType.Document> document;

    public static class Document {
        @XmlValue
        protected byte[] value;

        @XmlAttribute(name = "id", required = true)
        @XmlSchemaType(name = "anyURI")
        protected String id;

        ...
    }
    ...
}

Now this document is what gets attached as a mime part.
When I implemented this in a java project, it worked just fine. However when I started implementing this in a grails project I started getting an exception on calling the webservice.

2012-03-07 11:27:41,464 [http-bio-8080-exec-8] ERROR StackTrace  - Full Stack Trace:
org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary: --MIMEBoundary_4a94e41e3eed5d193a8c2b8ac8fa17bec22927a6b89fb8a1
        at org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:66)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
        at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:185)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
        at org.grails.cxf.GrailsCXFServlet.invoke(GroovyCXFServlet.groovy)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
        at org.grails.cxf.GrailsCXFServlet.handleRequest(GroovyCXFServlet.groovy)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
        at org.grails.cxf.GrailsCXFServlet.doPost(GroovyCXFServlet.groovy)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
        at org.grails.cxf.GrailsCXFServlet.service(GroovyCXFServlet.groovy)

I looked at another post (http://www.brimllc.com/2012/01/grails-cxf-web-service-with-mtom-attachments/) on Grails + CXF + MTOM that seems to suggest that I should be using DataHandler instead of byte[]. However since I'm building a contract-first webservice and using codegen, I can't do anything there.

I also implemented the suggestion that I should exclude '/services/*' in my UrlMappings to tell grails it shouldn't process what looks like attachments.

Does anyone have any suggestions?

R,
rahul
Reply | Threaded
Open this post in threaded view
|

Re: Grails + CXF + MTOM + Contract-first causes MIME boundary problems

rsom@certifydatasystems.com
I am trying to get the LoggingInInterceptor to kick in before the AttachmentInInterceptor. Does anyone have experience in getting that to work in the cxf plugin?

On Mar 7, 2012, at 11:49 AM, Rahul Somasunderam wrote:

I'm trying to create an endpoint using Grails + CXF. There is a WSDL that is provided by a standards body, and I have to use that as the contract for the web service.
When I use JAXB to codegen from the WSDL, I get a class that looks like this:

public class ProvideAndRegisterDocumentSetRequestType {
    ...
    protected List<ProvideAndRegisterDocumentSetRequestType.Document> document;

    public static class Document {
        @XmlValue
        protected byte[] value;

        @XmlAttribute(name = "id", required = true)
        @XmlSchemaType(name = "anyURI")
        protected String id;

        ...
    }
    ...
}

Now this document is what gets attached as a mime part.
When I implemented this in a java project, it worked just fine. However when I started implementing this in a grails project I started getting an exception on calling the webservice.

2012-03-07 11:27:41,464 [http-bio-8080-exec-8] ERROR StackTrace  - Full Stack Trace:
org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary: --MIMEBoundary_4a94e41e3eed5d193a8c2b8ac8fa17bec22927a6b89fb8a1
        at org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:66)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
        at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:185)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
        at org.grails.cxf.GrailsCXFServlet.invoke(GroovyCXFServlet.groovy)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
        at org.grails.cxf.GrailsCXFServlet.handleRequest(GroovyCXFServlet.groovy)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
        at org.grails.cxf.GrailsCXFServlet.doPost(GroovyCXFServlet.groovy)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
        at org.grails.cxf.GrailsCXFServlet.service(GroovyCXFServlet.groovy)

I looked at another post (http://www.brimllc.com/2012/01/grails-cxf-web-service-with-mtom-attachments/) on Grails + CXF + MTOM that seems to suggest that I should be using DataHandler instead of byte[]. However since I'm building a contract-first webservice and using codegen, I can't do anything there.

I also implemented the suggestion that I should exclude '/services/*' in my UrlMappings to tell grails it shouldn't process what looks like attachments.

Does anyone have any suggestions?

R,
rahul

Reply | Threaded
Open this post in threaded view
|

Re: Grails + CXF + MTOM + Contract-first causes MIME boundary problems

rsom@certifydatasystems.com
My understanding so far is that Grails is doing something to the InputStream of the request before CXF's AttachmentInterceptor gets to it.
I think it is the GrailsWebRequest filter.

Can someone please confirm it?

R,
rahul

On Mar 7, 2012, at 2:31 PM, Rahul Somasunderam wrote:

I am trying to get the LoggingInInterceptor to kick in before the AttachmentInInterceptor. Does anyone have experience in getting that to work in the cxf plugin?

On Mar 7, 2012, at 11:49 AM, Rahul Somasunderam wrote:

I'm trying to create an endpoint using Grails + CXF. There is a WSDL that is provided by a standards body, and I have to use that as the contract for the web service.
When I use JAXB to codegen from the WSDL, I get a class that looks like this:

public class ProvideAndRegisterDocumentSetRequestType {
    ...
    protected List<ProvideAndRegisterDocumentSetRequestType.Document> document;

    public static class Document {
        @XmlValue
        protected byte[] value;

        @XmlAttribute(name = "id", required = true)
        @XmlSchemaType(name = "anyURI")
        protected String id;

        ...
    }
    ...
}

Now this document is what gets attached as a mime part.
When I implemented this in a java project, it worked just fine. However when I started implementing this in a grails project I started getting an exception on calling the webservice.

2012-03-07 11:27:41,464 [http-bio-8080-exec-8] ERROR StackTrace  - Full Stack Trace:
org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary: --MIMEBoundary_4a94e41e3eed5d193a8c2b8ac8fa17bec22927a6b89fb8a1
        at org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:66)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
        at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:185)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
        at org.grails.cxf.GrailsCXFServlet.invoke(GroovyCXFServlet.groovy)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
        at org.grails.cxf.GrailsCXFServlet.handleRequest(GroovyCXFServlet.groovy)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
        at org.grails.cxf.GrailsCXFServlet.doPost(GroovyCXFServlet.groovy)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
        at org.grails.cxf.GrailsCXFServlet.service(GroovyCXFServlet.groovy)

I looked at another post (http://www.brimllc.com/2012/01/grails-cxf-web-service-with-mtom-attachments/) on Grails + CXF + MTOM that seems to suggest that I should be using DataHandler instead of byte[]. However since I'm building a contract-first webservice and using codegen, I can't do anything there.

I also implemented the suggestion that I should exclude '/services/*' in my UrlMappings to tell grails it shouldn't process what looks like attachments.

Does anyone have any suggestions?

R,
rahul


Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

rsom@certifydatasystems.com
OK. I got it resolved. Grails wants to help you by handling multipart requests including SOAP/MTOM. But it causes problems to CXF which is supposed to be doing that by looking at your InputStream.
The fix is in Config.groovy, set

grails.web.disable.multipart=true

R,
rahul

On Mar 7, 2012, at 3:15 PM, Rahul Somasunderam wrote:

My understanding so far is that Grails is doing something to the InputStream of the request before CXF's AttachmentInterceptor gets to it.
I think it is the GrailsWebRequest filter.

Can someone please confirm it?

R,
rahul

On Mar 7, 2012, at 2:31 PM, Rahul Somasunderam wrote:

I am trying to get the LoggingInInterceptor to kick in before the AttachmentInInterceptor. Does anyone have experience in getting that to work in the cxf plugin?

On Mar 7, 2012, at 11:49 AM, Rahul Somasunderam wrote:

I'm trying to create an endpoint using Grails + CXF. There is a WSDL that is provided by a standards body, and I have to use that as the contract for the web service.
When I use JAXB to codegen from the WSDL, I get a class that looks like this:

public class ProvideAndRegisterDocumentSetRequestType {
    ...
    protected List<ProvideAndRegisterDocumentSetRequestType.Document> document;

    public static class Document {
        @XmlValue
        protected byte[] value;

        @XmlAttribute(name = "id", required = true)
        @XmlSchemaType(name = "anyURI")
        protected String id;

        ...
    }
    ...
}

Now this document is what gets attached as a mime part.
When I implemented this in a java project, it worked just fine. However when I started implementing this in a grails project I started getting an exception on calling the webservice.

2012-03-07 11:27:41,464 [http-bio-8080-exec-8] ERROR StackTrace  - Full Stack Trace:
org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary: --MIMEBoundary_4a94e41e3eed5d193a8c2b8ac8fa17bec22927a6b89fb8a1
        at org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:66)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
        at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:185)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
        at org.grails.cxf.GrailsCXFServlet.invoke(GroovyCXFServlet.groovy)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
        at org.grails.cxf.GrailsCXFServlet.handleRequest(GroovyCXFServlet.groovy)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
        at org.grails.cxf.GrailsCXFServlet.doPost(GroovyCXFServlet.groovy)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
        at org.grails.cxf.GrailsCXFServlet.service(GroovyCXFServlet.groovy)

I looked at another post (http://www.brimllc.com/2012/01/grails-cxf-web-service-with-mtom-attachments/) on Grails + CXF + MTOM that seems to suggest that I should be using DataHandler instead of byte[]. However since I'm building a contract-first webservice and using codegen, I can't do anything there.

I also implemented the suggestion that I should exclude '/services/*' in my UrlMappings to tell grails it shouldn't process what looks like attachments.

Does anyone have any suggestions?

R,
rahul



Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

marcopas

Hi rahul,

May i ask if you develop contract first and after that generate the implementation? If so how do use the generated code in your Grails app?

-- send from my mobile phone

On Mar 8, 2012 1:14 AM, "Rahul Somasunderam" <[hidden email]> wrote:
OK. I got it resolved. Grails wants to help you by handling multipart requests including SOAP/MTOM. But it causes problems to CXF which is supposed to be doing that by looking at your InputStream.
The fix is in Config.groovy, set

grails.web.disable.multipart=true

R,
rahul

On Mar 7, 2012, at 3:15 PM, Rahul Somasunderam wrote:

My understanding so far is that Grails is doing something to the InputStream of the request before CXF's AttachmentInterceptor gets to it.
I think it is the GrailsWebRequest filter.

Can someone please confirm it?

R,
rahul

On Mar 7, 2012, at 2:31 PM, Rahul Somasunderam wrote:

I am trying to get the LoggingInInterceptor to kick in before the AttachmentInInterceptor. Does anyone have experience in getting that to work in the cxf plugin?

On Mar 7, 2012, at 11:49 AM, Rahul Somasunderam wrote:

I'm trying to create an endpoint using Grails + CXF. There is a WSDL that is provided by a standards body, and I have to use that as the contract for the web service.
When I use JAXB to codegen from the WSDL, I get a class that looks like this:

public class ProvideAndRegisterDocumentSetRequestType {
    ...
    protected List<ProvideAndRegisterDocumentSetRequestType.Document> document;

    public static class Document {
        @XmlValue
        protected byte[] value;

        @XmlAttribute(name = "id", required = true)
        @XmlSchemaType(name = "anyURI")
        protected String id;

        ...
    }
    ...
}

Now this document is what gets attached as a mime part.
When I implemented this in a java project, it worked just fine. However when I started implementing this in a grails project I started getting an exception on calling the webservice.

2012-03-07 11:27:41,464 [http-bio-8080-exec-8] ERROR StackTrace  - Full Stack Trace:
org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary: --MIMEBoundary_4a94e41e3eed5d193a8c2b8ac8fa17bec22927a6b89fb8a1
        at org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:66)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
        at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:185)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
        at org.grails.cxf.GrailsCXFServlet.invoke(GroovyCXFServlet.groovy)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
        at org.grails.cxf.GrailsCXFServlet.handleRequest(GroovyCXFServlet.groovy)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
        at org.grails.cxf.GrailsCXFServlet.doPost(GroovyCXFServlet.groovy)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
        at org.grails.cxf.GrailsCXFServlet.service(GroovyCXFServlet.groovy)

I looked at another post (http://www.brimllc.com/2012/01/grails-cxf-web-service-with-mtom-attachments/) on Grails + CXF + MTOM that seems to suggest that I should be using DataHandler instead of byte[]. However since I'm building a contract-first webservice and using codegen, I can't do anything there.

I also implemented the suggestion that I should exclude '/services/*' in my UrlMappings to tell grails it shouldn't process what looks like attachments.

Does anyone have any suggestions?

R,
rahul



Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

rsom@certifydatasystems.com
Hi Marco,

I am using a contract from a spec. My problem was with MTOM. CXF should have access to the InputStream to deal with MTOM. However since MTOM uses multipart/related as the content type, grails tries to parse the request and extract attachments.

This problem only affects people using any kind of MTOM web services.

R,
rahul

On Mar 7, 2012, at 11:30 PM, Marco Pas wrote:

Hi rahul,

May i ask if you develop contract first and after that generate the implementation? If so how do use the generated code in your Grails app?

-- send from my mobile phone

On Mar 8, 2012 1:14 AM, "Rahul Somasunderam" <[hidden email]> wrote:
OK. I got it resolved. Grails wants to help you by handling multipart requests including SOAP/MTOM. But it causes problems to CXF which is supposed to be doing that by looking at your InputStream.
The fix is in Config.groovy, set

grails.web.disable.multipart=true

R,
rahul

On Mar 7, 2012, at 3:15 PM, Rahul Somasunderam wrote:

My understanding so far is that Grails is doing something to the InputStream of the request before CXF's AttachmentInterceptor gets to it.
I think it is the GrailsWebRequest filter.

Can someone please confirm it?

R,
rahul

On Mar 7, 2012, at 2:31 PM, Rahul Somasunderam wrote:

I am trying to get the LoggingInInterceptor to kick in before the AttachmentInInterceptor. Does anyone have experience in getting that to work in the cxf plugin?

On Mar 7, 2012, at 11:49 AM, Rahul Somasunderam wrote:

I'm trying to create an endpoint using Grails + CXF. There is a WSDL that is provided by a standards body, and I have to use that as the contract for the web service.
When I use JAXB to codegen from the WSDL, I get a class that looks like this:

public class ProvideAndRegisterDocumentSetRequestType {
    ...
    protected List<ProvideAndRegisterDocumentSetRequestType.Document> document;

    public static class Document {
        @XmlValue
        protected byte[] value;

        @XmlAttribute(name = "id", required = true)
        @XmlSchemaType(name = "anyURI")
        protected String id;

        ...
    }
    ...
}

Now this document is what gets attached as a mime part.
When I implemented this in a java project, it worked just fine. However when I started implementing this in a grails project I started getting an exception on calling the webservice.

2012-03-07 11:27:41,464 [http-bio-8080-exec-8] ERROR StackTrace  - Full Stack Trace:
org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary: --MIMEBoundary_4a94e41e3eed5d193a8c2b8ac8fa17bec22927a6b89fb8a1
        at org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:66)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
        at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:185)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
        at org.grails.cxf.GrailsCXFServlet.invoke(GroovyCXFServlet.groovy)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
        at org.grails.cxf.GrailsCXFServlet.handleRequest(GroovyCXFServlet.groovy)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
        at org.grails.cxf.GrailsCXFServlet.doPost(GroovyCXFServlet.groovy)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
        at org.grails.cxf.GrailsCXFServlet.service(GroovyCXFServlet.groovy)

I looked at another post (http://www.brimllc.com/2012/01/grails-cxf-web-service-with-mtom-attachments/) on Grails + CXF + MTOM that seems to suggest that I should be using DataHandler instead of byte[]. However since I'm building a contract-first webservice and using codegen, I can't do anything there.

I also implemented the suggestion that I should exclude '/services/*' in my UrlMappings to tell grails it shouldn't process what looks like attachments.

Does anyone have any suggestions?

R,
rahul




Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

marcopas
Hi Rahul,

i am trying to get something similar going. I seem not to be able to
use a contract wsdl and implement it successfully within my Grails
application.

The steps that i have taken are:
1) get the wsdl contract that i need to implement
2) add cxf to my grails app
3) generate the classes with wsdl2java -d <output dir> -frontend
jaxws21 <path2wsdl>/contract.wsdl
4) place the generated classes into my src/java folder but after that
i seem to get stuck..

Could you share how you get a webservice implementation going with
this approach? Or am i doing something completly wrong?

/Marco

2012/3/8 Rahul Somasunderam <[hidden email]>:

> Hi Marco,
>
> I am using a contract from a spec. My problem was with MTOM. CXF should have
> access to the InputStream to deal with MTOM. However since MTOM uses
> multipart/related as the content type, grails tries to parse the request and
> extract attachments.
>
> This problem only affects people using any kind of MTOM web services.
>
> R,
> rahul
>
> On Mar 7, 2012, at 11:30 PM, Marco Pas wrote:
>
> Hi rahul,
>
> May i ask if you develop contract first and after that generate the
> implementation? If so how do use the generated code in your Grails app?
>
> -- send from my mobile phone
>
> On Mar 8, 2012 1:14 AM, "Rahul Somasunderam" <[hidden email]>
> wrote:
>>
>> OK. I got it resolved. Grails wants to help you by handling multipart
>> requests including SOAP/MTOM. But it causes problems to CXF which is
>> supposed to be doing that by looking at your InputStream.
>> The fix is in Config.groovy, set
>>
>> grails.web.disable.multipart=true
>>
>> R,
>> rahul
>>
>> On Mar 7, 2012, at 3:15 PM, Rahul Somasunderam wrote:
>>
>> My understanding so far is that Grails is doing something to the
>> InputStream of the request before CXF's AttachmentInterceptor gets to it.
>> I think it is the GrailsWebRequest filter.
>>
>> Can someone please confirm it?
>>
>> R,
>> rahul
>>
>> On Mar 7, 2012, at 2:31 PM, Rahul Somasunderam wrote:
>>
>> I am trying to get the LoggingInInterceptor to kick in before the
>> AttachmentInInterceptor. Does anyone have experience in getting that to work
>> in the cxf plugin?
>>
>> On Mar 7, 2012, at 11:49 AM, Rahul Somasunderam wrote:
>>
>> I'm trying to create an endpoint using Grails + CXF. There is a WSDL that
>> is provided by a standards body, and I have to use that as the contract for
>> the web service.
>> When I use JAXB to codegen from the WSDL, I get a class that looks like
>> this:
>>
>> public class ProvideAndRegisterDocumentSetRequestType {
>>     ...
>>     protected List<ProvideAndRegisterDocumentSetRequestType.Document>
>> document;
>>
>>     public static class Document {
>>         @XmlValue
>>         protected byte[] value;
>>
>>         @XmlAttribute(name = "id", required = true)
>>         @XmlSchemaType(name = "anyURI")
>>         protected String id;
>>
>>         ...
>>     }
>>     ...
>> }
>>
>> Now this document is what gets attached as a mime part.
>> When I implemented this in a java project, it worked just fine. However
>> when I started implementing this in a grails project I started getting an
>> exception on calling the webservice.
>>
>> 2012-03-07 11:27:41,464 [http-bio-8080-exec-8] ERROR StackTrace  - Full
>> Stack Trace:
>> org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary:
>> --MIMEBoundary_4a94e41e3eed5d193a8c2b8ac8fa17bec22927a6b89fb8a1
>>         at
>> org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:66)
>>         at
>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
>>         at
>> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
>>         at
>> org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
>>         at
>> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
>>         at
>> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:185)
>>         at
>> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
>>         at org.grails.cxf.GrailsCXFServlet.invoke(GroovyCXFServlet.groovy)
>>         at
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
>>         at
>> org.grails.cxf.GrailsCXFServlet.handleRequest(GroovyCXFServlet.groovy)
>>         at
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
>>         at org.grails.cxf.GrailsCXFServlet.doPost(GroovyCXFServlet.groovy)
>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
>>         at
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
>>         at
>> org.grails.cxf.GrailsCXFServlet.service(GroovyCXFServlet.groovy)
>>
>> I looked at another post
>> (http://www.brimllc.com/2012/01/grails-cxf-web-service-with-mtom-attachments/)
>> on Grails + CXF + MTOM that seems to suggest that I should be using
>> DataHandler instead of byte[]. However since I'm building a contract-first
>> webservice and using codegen, I can't do anything there.
>>
>> I also implemented the suggestion that I should exclude '/services/*' in
>> my UrlMappings to tell grails it shouldn't process what looks like
>> attachments.
>>
>> Does anyone have any suggestions?
>>
>> R,
>> rahul
>>
>>
>>
>>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

rsom@certifydatasystems.com
Wsdl2Java generates something like this:
@javax.jws.WebService(...)
@javax.xml.bind.annotation.XmlSeeAlso({...})
@javax.jws.soap.SOAPBinding(...)
public interface FooBarPortType  {
  
  @javax.jws.WebResult(...)
  @javax.xml.ws.Action(...)
  @javax.jws.WebMethod(...)
  FooType doSomething(@javax.jws.WebParam(...) BarType bar);

  ... 
}

Now create a Grails Service called FooBarService:
@MTOM(enabled = true)
@WebService(...)
@InInterceptors(...)
@OutInterceptors(...)
public class FooBarService implements FooBarPortType {
  @Resource
  WebServiceContext ctx
  static expose = ['cxfjax']

  // .. Implement methods ...
}

This should work. If you want debugging, enable the LoggingInInterceptor and LoggingOutInterceptor from cxf for your service.

R,
rahul


On Mar 8, 2012, at 11:13 AM, Marco Pas wrote:

Hi Rahul,

i am trying to get something similar going. I seem not to be able to
use a contract wsdl and implement it successfully within my Grails
application.

The steps that i have taken are:
1) get the wsdl contract that i need to implement
2) add cxf to my grails app
3) generate the classes with wsdl2java -d <output dir> -frontend
jaxws21 <path2wsdl>/contract.wsdl
4) place the generated classes into my src/java folder but after that
i seem to get stuck..

Could you share how you get a webservice implementation going with
this approach? Or am i doing something completly wrong?

/Marco

2012/3/8 Rahul Somasunderam <[hidden email]>:
Hi Marco,

I am using a contract from a spec. My problem was with MTOM. CXF should have
access to the InputStream to deal with MTOM. However since MTOM uses
multipart/related as the content type, grails tries to parse the request and
extract attachments.

This problem only affects people using any kind of MTOM web services.

R,
rahul

On Mar 7, 2012, at 11:30 PM, Marco Pas wrote:

Hi rahul,

May i ask if you develop contract first and after that generate the
implementation? If so how do use the generated code in your Grails app?

-- send from my mobile phone

On Mar 8, 2012 1:14 AM, "Rahul Somasunderam" <[hidden email]>
wrote:

OK. I got it resolved. Grails wants to help you by handling multipart
requests including SOAP/MTOM. But it causes problems to CXF which is
supposed to be doing that by looking at your InputStream.
The fix is in Config.groovy, set

grails.web.disable.multipart=true

R,
rahul

On Mar 7, 2012, at 3:15 PM, Rahul Somasunderam wrote:

My understanding so far is that Grails is doing something to the
InputStream of the request before CXF's AttachmentInterceptor gets to it.
I think it is the GrailsWebRequest filter.

Can someone please confirm it?

R,
rahul

On Mar 7, 2012, at 2:31 PM, Rahul Somasunderam wrote:

I am trying to get the LoggingInInterceptor to kick in before the
AttachmentInInterceptor. Does anyone have experience in getting that to work
in the cxf plugin?

On Mar 7, 2012, at 11:49 AM, Rahul Somasunderam wrote:

I'm trying to create an endpoint using Grails + CXF. There is a WSDL that
is provided by a standards body, and I have to use that as the contract for
the web service.
When I use JAXB to codegen from the WSDL, I get a class that looks like
this:

public class ProvideAndRegisterDocumentSetRequestType {
    ...
    protected List<ProvideAndRegisterDocumentSetRequestType.Document>
document;

    public static class Document {
        @XmlValue
        protected byte[] value;

        @XmlAttribute(name = "id", required = true)
        @XmlSchemaType(name = "anyURI")
        protected String id;

        ...
    }
    ...
}

Now this document is what gets attached as a mime part.
When I implemented this in a java project, it worked just fine. However
when I started implementing this in a grails project I started getting an
exception on calling the webservice.

2012-03-07 11:27:41,464 [http-bio-8080-exec-8] ERROR StackTrace  - Full
Stack Trace:
org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary:
--MIMEBoundary_4a94e41e3eed5d193a8c2b8ac8fa17bec22927a6b89fb8a1
        at
org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:66)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
        at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
        at
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
        at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
        at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:185)
        at
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
        at org.grails.cxf.GrailsCXFServlet.invoke(GroovyCXFServlet.groovy)
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
        at
org.grails.cxf.GrailsCXFServlet.handleRequest(GroovyCXFServlet.groovy)
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
        at org.grails.cxf.GrailsCXFServlet.doPost(GroovyCXFServlet.groovy)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
        at
org.grails.cxf.GrailsCXFServlet.service(GroovyCXFServlet.groovy)

I looked at another post
(http://www.brimllc.com/2012/01/grails-cxf-web-service-with-mtom-attachments/)
on Grails + CXF + MTOM that seems to suggest that I should be using
DataHandler instead of byte[]. However since I'm building a contract-first
webservice and using codegen, I can't do anything there.

I also implemented the suggestion that I should exclude '/services/*' in
my UrlMappings to tell grails it shouldn't process what looks like
attachments.

Does anyone have any suggestions?

R,
rahul






---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

rsom@certifydatasystems.com
And another thing I'm doing different is, I use the maven cxf-codegen-plugin to do the codegen in a maven project and include that as a dependency in my grails project.
However that should not make a huge difference.

R,
rahul

On Mar 9, 2012, at 9:34 AM, Rahul Somasunderam wrote:

Wsdl2Java generates something like this:
@javax.jws.WebService(...)
@javax.xml.bind.annotation.XmlSeeAlso({...})
@javax.jws.soap.SOAPBinding(...)
public interface FooBarPortType  {
  
  @javax.jws.WebResult(...)
  @javax.xml.ws.Action(...)
  @javax.jws.WebMethod(...)
  FooType doSomething(@javax.jws.WebParam(...) BarType bar);

  ... 
}

Now create a Grails Service called FooBarService:
@MTOM(enabled = true)
@WebService(...)
@InInterceptors(...)
@OutInterceptors(...)
public class FooBarService implements FooBarPortType {
  @Resource
  WebServiceContext ctx
  static expose = ['cxfjax']

  // .. Implement methods ...
}

This should work. If you want debugging, enable the LoggingInInterceptor and LoggingOutInterceptor from cxf for your service.

R,
rahul


On Mar 8, 2012, at 11:13 AM, Marco Pas wrote:

Hi Rahul,

i am trying to get something similar going. I seem not to be able to
use a contract wsdl and implement it successfully within my Grails
application.

The steps that i have taken are:
1) get the wsdl contract that i need to implement
2) add cxf to my grails app
3) generate the classes with wsdl2java -d <output dir> -frontend
jaxws21 <path2wsdl>/contract.wsdl
4) place the generated classes into my src/java folder but after that
i seem to get stuck..

Could you share how you get a webservice implementation going with
this approach? Or am i doing something completly wrong?

/Marco

2012/3/8 Rahul Somasunderam <[hidden email]>:
Hi Marco,

I am using a contract from a spec. My problem was with MTOM. CXF should have
access to the InputStream to deal with MTOM. However since MTOM uses
multipart/related as the content type, grails tries to parse the request and
extract attachments.

This problem only affects people using any kind of MTOM web services.

R,
rahul

On Mar 7, 2012, at 11:30 PM, Marco Pas wrote:

Hi rahul,

May i ask if you develop contract first and after that generate the
implementation? If so how do use the generated code in your Grails app?

-- send from my mobile phone

On Mar 8, 2012 1:14 AM, "Rahul Somasunderam" <[hidden email]>
wrote:

OK. I got it resolved. Grails wants to help you by handling multipart
requests including SOAP/MTOM. But it causes problems to CXF which is
supposed to be doing that by looking at your InputStream.
The fix is in Config.groovy, set

grails.web.disable.multipart=true

R,
rahul

On Mar 7, 2012, at 3:15 PM, Rahul Somasunderam wrote:

My understanding so far is that Grails is doing something to the
InputStream of the request before CXF's AttachmentInterceptor gets to it.
I think it is the GrailsWebRequest filter.

Can someone please confirm it?

R,
rahul

On Mar 7, 2012, at 2:31 PM, Rahul Somasunderam wrote:

I am trying to get the LoggingInInterceptor to kick in before the
AttachmentInInterceptor. Does anyone have experience in getting that to work
in the cxf plugin?

On Mar 7, 2012, at 11:49 AM, Rahul Somasunderam wrote:

I'm trying to create an endpoint using Grails + CXF. There is a WSDL that
is provided by a standards body, and I have to use that as the contract for
the web service.
When I use JAXB to codegen from the WSDL, I get a class that looks like
this:

public class ProvideAndRegisterDocumentSetRequestType {
    ...
    protected List<ProvideAndRegisterDocumentSetRequestType.Document>
document;

    public static class Document {
        @XmlValue
        protected byte[] value;

        @XmlAttribute(name = "id", required = true)
        @XmlSchemaType(name = "anyURI")
        protected String id;

        ...
    }
    ...
}

Now this document is what gets attached as a mime part.
When I implemented this in a java project, it worked just fine. However
when I started implementing this in a grails project I started getting an
exception on calling the webservice.

2012-03-07 11:27:41,464 [http-bio-8080-exec-8] ERROR StackTrace  - Full
Stack Trace:
org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary:
--MIMEBoundary_4a94e41e3eed5d193a8c2b8ac8fa17bec22927a6b89fb8a1
        at
org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:66)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
        at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
        at
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
        at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
        at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:185)
        at
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
        at org.grails.cxf.GrailsCXFServlet.invoke(GroovyCXFServlet.groovy)
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
        at
org.grails.cxf.GrailsCXFServlet.handleRequest(GroovyCXFServlet.groovy)
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
        at org.grails.cxf.GrailsCXFServlet.doPost(GroovyCXFServlet.groovy)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
        at
org.grails.cxf.GrailsCXFServlet.service(GroovyCXFServlet.groovy)

I looked at another post
(http://www.brimllc.com/2012/01/grails-cxf-web-service-with-mtom-attachments/)
on Grails + CXF + MTOM that seems to suggest that I should be using
DataHandler instead of byte[]. However since I'm building a contract-first
webservice and using codegen, I can't do anything there.

I also implemented the suggestion that I should exclude '/services/*' in
my UrlMappings to tell grails it shouldn't process what looks like
attachments.

Does anyone have any suggestions?

R,
rahul






---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

marcopas
In reply to this post by rsom@certifydatasystems.com
Rahul,

how do you bind the Grails services etc
Do you use a resources.xml or is the ['cxfjax'] doing this automatically?

2012/3/9 Rahul Somasunderam <[hidden email]>:

> Wsdl2Java generates something like this:
> @javax.jws.WebService(...)
> @javax.xml.bind.annotation.XmlSeeAlso({...})
> @javax.jws.soap.SOAPBinding(...)
> public interface FooBarPortType  {
>
>   @javax.jws.WebResult(...)
>   @javax.xml.ws.Action(...)
>   @javax.jws.WebMethod(...)
>   FooType doSomething(@javax.jws.WebParam(...) BarType bar);
>
>   ...
> }
>
> Now create a Grails Service called FooBarService:
> @MTOM(enabled = true)
> @WebService(...)
> @InInterceptors(...)
> @OutInterceptors(...)
> public class FooBarService implements FooBarPortType {
>   @Resource
>   WebServiceContext ctx
>   static expose = ['cxfjax']
>
>   // .. Implement methods ...
> }
>
> This should work. If you want debugging, enable the LoggingInInterceptor and
> LoggingOutInterceptor from cxf for your service.
>
> R,
> rahul
>
>
> On Mar 8, 2012, at 11:13 AM, Marco Pas wrote:
>
> Hi Rahul,
>
> i am trying to get something similar going. I seem not to be able to
> use a contract wsdl and implement it successfully within my Grails
> application.
>
> The steps that i have taken are:
> 1) get the wsdl contract that i need to implement
> 2) add cxf to my grails app
> 3) generate the classes with wsdl2java -d <output dir> -frontend
> jaxws21 <path2wsdl>/contract.wsdl
> 4) place the generated classes into my src/java folder but after that
> i seem to get stuck..
>
> Could you share how you get a webservice implementation going with
> this approach? Or am i doing something completly wrong?
>
> /Marco
>
> 2012/3/8 Rahul Somasunderam <[hidden email]>:
>
> Hi Marco,
>
>
> I am using a contract from a spec. My problem was with MTOM. CXF should have
>
> access to the InputStream to deal with MTOM. However since MTOM uses
>
> multipart/related as the content type, grails tries to parse the request and
>
> extract attachments.
>
>
> This problem only affects people using any kind of MTOM web services.
>
>
> R,
>
> rahul
>
>
> On Mar 7, 2012, at 11:30 PM, Marco Pas wrote:
>
>
> Hi rahul,
>
>
> May i ask if you develop contract first and after that generate the
>
> implementation? If so how do use the generated code in your Grails app?
>
>
> -- send from my mobile phone
>
>
> On Mar 8, 2012 1:14 AM, "Rahul Somasunderam" <[hidden email]>
>
> wrote:
>
>
> OK. I got it resolved. Grails wants to help you by handling multipart
>
> requests including SOAP/MTOM. But it causes problems to CXF which is
>
> supposed to be doing that by looking at your InputStream.
>
> The fix is in Config.groovy, set
>
>
> grails.web.disable.multipart=true
>
>
> R,
>
> rahul
>
>
> On Mar 7, 2012, at 3:15 PM, Rahul Somasunderam wrote:
>
>
> My understanding so far is that Grails is doing something to the
>
> InputStream of the request before CXF's AttachmentInterceptor gets to it.
>
> I think it is the GrailsWebRequest filter.
>
>
> Can someone please confirm it?
>
>
> R,
>
> rahul
>
>
> On Mar 7, 2012, at 2:31 PM, Rahul Somasunderam wrote:
>
>
> I am trying to get the LoggingInInterceptor to kick in before the
>
> AttachmentInInterceptor. Does anyone have experience in getting that to work
>
> in the cxf plugin?
>
>
> On Mar 7, 2012, at 11:49 AM, Rahul Somasunderam wrote:
>
>
> I'm trying to create an endpoint using Grails + CXF. There is a WSDL that
>
> is provided by a standards body, and I have to use that as the contract for
>
> the web service.
>
> When I use JAXB to codegen from the WSDL, I get a class that looks like
>
> this:
>
>
> public class ProvideAndRegisterDocumentSetRequestType {
>
>     ...
>
>     protected List<ProvideAndRegisterDocumentSetRequestType.Document>
>
> document;
>
>
>     public static class Document {
>
>         @XmlValue
>
>         protected byte[] value;
>
>
>         @XmlAttribute(name = "id", required = true)
>
>         @XmlSchemaType(name = "anyURI")
>
>         protected String id;
>
>
>         ...
>
>     }
>
>     ...
>
> }
>
>
> Now this document is what gets attached as a mime part.
>
> When I implemented this in a java project, it worked just fine. However
>
> when I started implementing this in a grails project I started getting an
>
> exception on calling the webservice.
>
>
> 2012-03-07 11:27:41,464 [http-bio-8080-exec-8] ERROR StackTrace  - Full
>
> Stack Trace:
>
> org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary:
>
> --MIMEBoundary_4a94e41e3eed5d193a8c2b8ac8fa17bec22927a6b89fb8a1
>
>         at
>
> org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:66)
>
>         at
>
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
>
>         at
>
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
>
>         at
>
> org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
>
>         at
>
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
>
>         at
>
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:185)
>
>         at
>
> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
>
>         at org.grails.cxf.GrailsCXFServlet.invoke(GroovyCXFServlet.groovy)
>
>         at
>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
>
>         at
>
> org.grails.cxf.GrailsCXFServlet.handleRequest(GroovyCXFServlet.groovy)
>
>         at
>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
>
>         at org.grails.cxf.GrailsCXFServlet.doPost(GroovyCXFServlet.groovy)
>
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
>
>         at
>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
>
>         at
>
> org.grails.cxf.GrailsCXFServlet.service(GroovyCXFServlet.groovy)
>
>
> I looked at another post
>
> (http://www.brimllc.com/2012/01/grails-cxf-web-service-with-mtom-attachments/)
>
> on Grails + CXF + MTOM that seems to suggest that I should be using
>
> DataHandler instead of byte[]. However since I'm building a contract-first
>
> webservice and using codegen, I can't do anything there.
>
>
> I also implemented the suggestion that I should exclude '/services/*' in
>
> my UrlMappings to tell grails it shouldn't process what looks like
>
> attachments.
>
>
> Does anyone have any suggestions?
>
>
> R,
>
> rahul
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

marcopas
I am trying to follow the required steps but i keep hitting a wall...

1) I generated the interface using wsdl2java

@WebService(name = "currencyConvert", targetNamespace =
"http://www.examplewebservice.com")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@XmlSeeAlso({
    ObjectFactory.class
})
public interface CurrencyConvert {
    /**
     *
     * @param part1
     * @return
     *     returns nl.test.ConversionResponse
     */
    @WebMethod
    @WebResult(name = "conversionResponse", targetNamespace =
"http://www.examplewebservice.com/types", partName = "part1")
    public ConversionResponse convert(
            @WebParam(name = "conversionRequest", targetNamespace =
"http://www.examplewebservice.com/types", partName = "part1")
            ConversionRequest part1);
}

2) I copied the generated interface to the java/src folder
3) I created service which extends the generated interface

import test.CurrencyConvert

class ConverterService implements CurrencyConvert {

    static expose=['cxfjax']

    test.ConversionResponse convert(test.ConversionRequest part1) {
        return null  //To change body of implemented methods use File
| Settings | File Templates.
    }
}

4) now the service pops up but i am missing the request and response
type in the wsdl :(

Any hints or clues what i am missing?

2012/3/12 Marco Pas <[hidden email]>:

> Rahul,
>
> how do you bind the Grails services etc
> Do you use a resources.xml or is the ['cxfjax'] doing this automatically?
>
> 2012/3/9 Rahul Somasunderam <[hidden email]>:
>> Wsdl2Java generates something like this:
>> @javax.jws.WebService(...)
>> @javax.xml.bind.annotation.XmlSeeAlso({...})
>> @javax.jws.soap.SOAPBinding(...)
>> public interface FooBarPortType  {
>>
>>   @javax.jws.WebResult(...)
>>   @javax.xml.ws.Action(...)
>>   @javax.jws.WebMethod(...)
>>   FooType doSomething(@javax.jws.WebParam(...) BarType bar);
>>
>>   ...
>> }
>>
>> Now create a Grails Service called FooBarService:
>> @MTOM(enabled = true)
>> @WebService(...)
>> @InInterceptors(...)
>> @OutInterceptors(...)
>> public class FooBarService implements FooBarPortType {
>>   @Resource
>>   WebServiceContext ctx
>>   static expose = ['cxfjax']
>>
>>   // .. Implement methods ...
>> }
>>
>> This should work. If you want debugging, enable the LoggingInInterceptor and
>> LoggingOutInterceptor from cxf for your service.
>>
>> R,
>> rahul
>>
>>
>> On Mar 8, 2012, at 11:13 AM, Marco Pas wrote:
>>
>> Hi Rahul,
>>
>> i am trying to get something similar going. I seem not to be able to
>> use a contract wsdl and implement it successfully within my Grails
>> application.
>>
>> The steps that i have taken are:
>> 1) get the wsdl contract that i need to implement
>> 2) add cxf to my grails app
>> 3) generate the classes with wsdl2java -d <output dir> -frontend
>> jaxws21 <path2wsdl>/contract.wsdl
>> 4) place the generated classes into my src/java folder but after that
>> i seem to get stuck..
>>
>> Could you share how you get a webservice implementation going with
>> this approach? Or am i doing something completly wrong?
>>
>> /Marco
>>
>> 2012/3/8 Rahul Somasunderam <[hidden email]>:
>>
>> Hi Marco,
>>
>>
>> I am using a contract from a spec. My problem was with MTOM. CXF should have
>>
>> access to the InputStream to deal with MTOM. However since MTOM uses
>>
>> multipart/related as the content type, grails tries to parse the request and
>>
>> extract attachments.
>>
>>
>> This problem only affects people using any kind of MTOM web services.
>>
>>
>> R,
>>
>> rahul
>>
>>
>> On Mar 7, 2012, at 11:30 PM, Marco Pas wrote:
>>
>>
>> Hi rahul,
>>
>>
>> May i ask if you develop contract first and after that generate the
>>
>> implementation? If so how do use the generated code in your Grails app?
>>
>>
>> -- send from my mobile phone
>>
>>
>> On Mar 8, 2012 1:14 AM, "Rahul Somasunderam" <[hidden email]>
>>
>> wrote:
>>
>>
>> OK. I got it resolved. Grails wants to help you by handling multipart
>>
>> requests including SOAP/MTOM. But it causes problems to CXF which is
>>
>> supposed to be doing that by looking at your InputStream.
>>
>> The fix is in Config.groovy, set
>>
>>
>> grails.web.disable.multipart=true
>>
>>
>> R,
>>
>> rahul
>>
>>
>> On Mar 7, 2012, at 3:15 PM, Rahul Somasunderam wrote:
>>
>>
>> My understanding so far is that Grails is doing something to the
>>
>> InputStream of the request before CXF's AttachmentInterceptor gets to it.
>>
>> I think it is the GrailsWebRequest filter.
>>
>>
>> Can someone please confirm it?
>>
>>
>> R,
>>
>> rahul
>>
>>
>> On Mar 7, 2012, at 2:31 PM, Rahul Somasunderam wrote:
>>
>>
>> I am trying to get the LoggingInInterceptor to kick in before the
>>
>> AttachmentInInterceptor. Does anyone have experience in getting that to work
>>
>> in the cxf plugin?
>>
>>
>> On Mar 7, 2012, at 11:49 AM, Rahul Somasunderam wrote:
>>
>>
>> I'm trying to create an endpoint using Grails + CXF. There is a WSDL that
>>
>> is provided by a standards body, and I have to use that as the contract for
>>
>> the web service.
>>
>> When I use JAXB to codegen from the WSDL, I get a class that looks like
>>
>> this:
>>
>>
>> public class ProvideAndRegisterDocumentSetRequestType {
>>
>>     ...
>>
>>     protected List<ProvideAndRegisterDocumentSetRequestType.Document>
>>
>> document;
>>
>>
>>     public static class Document {
>>
>>         @XmlValue
>>
>>         protected byte[] value;
>>
>>
>>         @XmlAttribute(name = "id", required = true)
>>
>>         @XmlSchemaType(name = "anyURI")
>>
>>         protected String id;
>>
>>
>>         ...
>>
>>     }
>>
>>     ...
>>
>> }
>>
>>
>> Now this document is what gets attached as a mime part.
>>
>> When I implemented this in a java project, it worked just fine. However
>>
>> when I started implementing this in a grails project I started getting an
>>
>> exception on calling the webservice.
>>
>>
>> 2012-03-07 11:27:41,464 [http-bio-8080-exec-8] ERROR StackTrace  - Full
>>
>> Stack Trace:
>>
>> org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary:
>>
>> --MIMEBoundary_4a94e41e3eed5d193a8c2b8ac8fa17bec22927a6b89fb8a1
>>
>>         at
>>
>> org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:66)
>>
>>         at
>>
>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
>>
>>         at
>>
>> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
>>
>>         at
>>
>> org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
>>
>>         at
>>
>> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
>>
>>         at
>>
>> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:185)
>>
>>         at
>>
>> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
>>
>>         at org.grails.cxf.GrailsCXFServlet.invoke(GroovyCXFServlet.groovy)
>>
>>         at
>>
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
>>
>>         at
>>
>> org.grails.cxf.GrailsCXFServlet.handleRequest(GroovyCXFServlet.groovy)
>>
>>         at
>>
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
>>
>>         at org.grails.cxf.GrailsCXFServlet.doPost(GroovyCXFServlet.groovy)
>>
>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
>>
>>         at
>>
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
>>
>>         at
>>
>> org.grails.cxf.GrailsCXFServlet.service(GroovyCXFServlet.groovy)
>>
>>
>> I looked at another post
>>
>> (http://www.brimllc.com/2012/01/grails-cxf-web-service-with-mtom-attachments/)
>>
>> on Grails + CXF + MTOM that seems to suggest that I should be using
>>
>> DataHandler instead of byte[]. However since I'm building a contract-first
>>
>> webservice and using codegen, I can't do anything there.
>>
>>
>> I also implemented the suggestion that I should exclude '/services/*' in
>>
>> my UrlMappings to tell grails it shouldn't process what looks like
>>
>> attachments.
>>
>>
>> Does anyone have any suggestions?
>>
>>
>> R,
>>
>> rahul
>>
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

Ian Roberts
On 12/03/2012 21:55, Marco Pas wrote:

> class ConverterService implements CurrencyConvert {
>
>     static expose=['cxfjax']
>
>     test.ConversionResponse convert(test.ConversionRequest part1) {
>         return null  //To change body of implemented methods use File
> | Settings | File Templates.
>     }
> }
>
> 4) now the service pops up but i am missing the request and response
> type in the wsdl :(
>
> Any hints or clues what i am missing?

Just a guess but does it help if you annotate the ConverterService with
@WebService(endpointInterface = "com.example.CurrencyConvert")?

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

marcopas
2012/3/13 Ian Roberts <[hidden email]>:

> On 12/03/2012 21:55, Marco Pas wrote:
>> class ConverterService implements CurrencyConvert {
>>
>>     static expose=['cxfjax']
>>
>>     test.ConversionResponse convert(test.ConversionRequest part1) {
>>         return null  //To change body of implemented methods use File
>> | Settings | File Templates.
>>     }
>> }
>>
>> 4) now the service pops up but i am missing the request and response
>> type in the wsdl :(
>>
>> Any hints or clues what i am missing?
>
> Just a guess but does it help if you annotate the ConverterService with
> @WebService(endpointInterface = "com.example.CurrencyConvert")?
>
> Ian
>
> --
> Ian Roberts               | Department of Computer Science
> [hidden email]  | University of Sheffield, UK
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

Hi Ian,

thanks for your reply..  things brings me a little bit closer to the
actual implementation. Now i can see the wsdl but when i call the
actual webservice using SoapUI i get the follow error message:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Client</faultcode>
         <faultstring>Unmarshalling Error: unexpected element
(uri:"http://www.examplewebservice.com/types", local:"fromCurrency").
Expected elements are
&lt;{}amount>,&lt;{}fromCurrency>,&lt;{}toCurrency></faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

I annotated the service with the following:


@WebService(
    targetNamespace = "http://www.examplewebservice.com")
class ConverterService implements CurrencyConvert {

    static expose=['cxfjax']

    ConversionResponse convert(ConversionRequest part1) {
        println "inside the webservice call"
        return null  //To change body of implemented methods use File
| Settings | File Templates.
    }
}

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

Ian Roberts
On 13/03/2012 16:01, Marco Pas wrote:
> I annotated the service with the following:
>
> @WebService(
>     targetNamespace = "http://www.examplewebservice.com")
> class ConverterService implements CurrencyConvert {

I suggested you try endpointInterface = "pkg.of.CurrencyConvert" on the
implementation class's @WebService annotation - this is what makes the
link between the interface (with the various @WebMethod, @WebParam etc.
annotations) and the implementing class.

The error message suggests that SoapUI is sending a conversionRequest
whose child elements are namespace-qualified but the service
implementation expects them to be unqualified.  Which is it supposed to
be according to the WSDL (either the original one you started from or
the one CXF is generating)?  I'm trying to work out whether this is a
problem in your service or whether it's a problem in SoapUI...

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

marcopas
Hi Ian,

i restarted cleaned everything and started all over again..

1) generated the interface wsd2java using 'wsdl2java -fe jaxws21 -d
<output-dir> -impl <location+wsdl file>
2) moved the interface and request and response stuff to the java src
3) implemented a service with the following

class ConverterService implements CurrencyConvert {
    static expose=['cxf']

    ConversionResponse convert(ConversionRequest part1) {
        println "inside the webservice call"
        ConversionResponse resp = new ConversionResponse()
        resp.setAmount(3.0f)
        return resp
    }
}

THIS Works :) so far... :) Do not know what i did wrong but the
actuall Grails service is called by using SOAP-UI :)
But whenever i try to use "static expose=['cxfjax']" i am loosing my
request and response types.
I tried to annotate the service with endpointInterface =
"pkg.of.CurrencyConvert" with no luck..

So far i can get away with the "static expose=['cxf]" annotation i
guess, but still i am wondering why the webservice is loosing is
request and response types when using
"static expose=['cxfjax']"

@WebService(
    serviceName = "foobarService",
    targetNamespace = "http://www.examplewebservice.com",
    portName = "converterFooBarSoapPort",
    endpointInterface = "com.examplewebservice.CurrencyConvert"
)
class ConverterService implements CurrencyConvert {

    static expose=['cxfjax']

    ConversionResponse convert(ConversionRequest part1) {
        println "inside the webservice call"
        ConversionResponse resp = new ConversionResponse()
        resp.setAmount(3.0f)
        return resp  //To change body of implemented methods use File
| Settings | File Templates.
    }
}

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

rsom@certifydatasystems.com
In reply to this post by marcopas
static expose = ['cxfjax'] does the binding for me automatically.

R,
rahul
On Mar 12, 2012, at 9:18 AM, Marco Pas wrote:

> Rahul,
>
> how do you bind the Grails services etc
> Do you use a resources.xml or is the ['cxfjax'] doing this automatically?
>
> 2012/3/9 Rahul Somasunderam <[hidden email]>:
>> Wsdl2Java generates something like this:
>> @javax.jws.WebService(...)
>> @javax.xml.bind.annotation.XmlSeeAlso({...})
>> @javax.jws.soap.SOAPBinding(...)
>> public interface FooBarPortType  {
>>
>>   @javax.jws.WebResult(...)
>>   @javax.xml.ws.Action(...)
>>   @javax.jws.WebMethod(...)
>>   FooType doSomething(@javax.jws.WebParam(...) BarType bar);
>>
>>   ...
>> }
>>
>> Now create a Grails Service called FooBarService:
>> @MTOM(enabled = true)
>> @WebService(...)
>> @InInterceptors(...)
>> @OutInterceptors(...)
>> public class FooBarService implements FooBarPortType {
>>   @Resource
>>   WebServiceContext ctx
>>   static expose = ['cxfjax']
>>
>>   // .. Implement methods ...
>> }
>>
>> This should work. If you want debugging, enable the LoggingInInterceptor and
>> LoggingOutInterceptor from cxf for your service.
>>
>> R,
>> rahul
>>
>>
>> On Mar 8, 2012, at 11:13 AM, Marco Pas wrote:
>>
>> Hi Rahul,
>>
>> i am trying to get something similar going. I seem not to be able to
>> use a contract wsdl and implement it successfully within my Grails
>> application.
>>
>> The steps that i have taken are:
>> 1) get the wsdl contract that i need to implement
>> 2) add cxf to my grails app
>> 3) generate the classes with wsdl2java -d <output dir> -frontend
>> jaxws21 <path2wsdl>/contract.wsdl
>> 4) place the generated classes into my src/java folder but after that
>> i seem to get stuck..
>>
>> Could you share how you get a webservice implementation going with
>> this approach? Or am i doing something completly wrong?
>>
>> /Marco
>>
>> 2012/3/8 Rahul Somasunderam <[hidden email]>:
>>
>> Hi Marco,
>>
>>
>> I am using a contract from a spec. My problem was with MTOM. CXF should have
>>
>> access to the InputStream to deal with MTOM. However since MTOM uses
>>
>> multipart/related as the content type, grails tries to parse the request and
>>
>> extract attachments.
>>
>>
>> This problem only affects people using any kind of MTOM web services.
>>
>>
>> R,
>>
>> rahul
>>
>>
>> On Mar 7, 2012, at 11:30 PM, Marco Pas wrote:
>>
>>
>> Hi rahul,
>>
>>
>> May i ask if you develop contract first and after that generate the
>>
>> implementation? If so how do use the generated code in your Grails app?
>>
>>
>> -- send from my mobile phone
>>
>>
>> On Mar 8, 2012 1:14 AM, "Rahul Somasunderam" <[hidden email]>
>>
>> wrote:
>>
>>
>> OK. I got it resolved. Grails wants to help you by handling multipart
>>
>> requests including SOAP/MTOM. But it causes problems to CXF which is
>>
>> supposed to be doing that by looking at your InputStream.
>>
>> The fix is in Config.groovy, set
>>
>>
>> grails.web.disable.multipart=true
>>
>>
>> R,
>>
>> rahul
>>
>>
>> On Mar 7, 2012, at 3:15 PM, Rahul Somasunderam wrote:
>>
>>
>> My understanding so far is that Grails is doing something to the
>>
>> InputStream of the request before CXF's AttachmentInterceptor gets to it.
>>
>> I think it is the GrailsWebRequest filter.
>>
>>
>> Can someone please confirm it?
>>
>>
>> R,
>>
>> rahul
>>
>>
>> On Mar 7, 2012, at 2:31 PM, Rahul Somasunderam wrote:
>>
>>
>> I am trying to get the LoggingInInterceptor to kick in before the
>>
>> AttachmentInInterceptor. Does anyone have experience in getting that to work
>>
>> in the cxf plugin?
>>
>>
>> On Mar 7, 2012, at 11:49 AM, Rahul Somasunderam wrote:
>>
>>
>> I'm trying to create an endpoint using Grails + CXF. There is a WSDL that
>>
>> is provided by a standards body, and I have to use that as the contract for
>>
>> the web service.
>>
>> When I use JAXB to codegen from the WSDL, I get a class that looks like
>>
>> this:
>>
>>
>> public class ProvideAndRegisterDocumentSetRequestType {
>>
>>     ...
>>
>>     protected List<ProvideAndRegisterDocumentSetRequestType.Document>
>>
>> document;
>>
>>
>>     public static class Document {
>>
>>         @XmlValue
>>
>>         protected byte[] value;
>>
>>
>>         @XmlAttribute(name = "id", required = true)
>>
>>         @XmlSchemaType(name = "anyURI")
>>
>>         protected String id;
>>
>>
>>         ...
>>
>>     }
>>
>>     ...
>>
>> }
>>
>>
>> Now this document is what gets attached as a mime part.
>>
>> When I implemented this in a java project, it worked just fine. However
>>
>> when I started implementing this in a grails project I started getting an
>>
>> exception on calling the webservice.
>>
>>
>> 2012-03-07 11:27:41,464 [http-bio-8080-exec-8] ERROR StackTrace  - Full
>>
>> Stack Trace:
>>
>> org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary:
>>
>> --MIMEBoundary_4a94e41e3eed5d193a8c2b8ac8fa17bec22927a6b89fb8a1
>>
>>         at
>>
>> org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:66)
>>
>>         at
>>
>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
>>
>>         at
>>
>> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
>>
>>         at
>>
>> org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
>>
>>         at
>>
>> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
>>
>>         at
>>
>> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:185)
>>
>>         at
>>
>> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
>>
>>         at org.grails.cxf.GrailsCXFServlet.invoke(GroovyCXFServlet.groovy)
>>
>>         at
>>
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
>>
>>         at
>>
>> org.grails.cxf.GrailsCXFServlet.handleRequest(GroovyCXFServlet.groovy)
>>
>>         at
>>
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
>>
>>         at org.grails.cxf.GrailsCXFServlet.doPost(GroovyCXFServlet.groovy)
>>
>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
>>
>>         at
>>
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
>>
>>         at
>>
>> org.grails.cxf.GrailsCXFServlet.service(GroovyCXFServlet.groovy)
>>
>>
>> I looked at another post
>>
>> (http://www.brimllc.com/2012/01/grails-cxf-web-service-with-mtom-attachments/)
>>
>> on Grails + CXF + MTOM that seems to suggest that I should be using
>>
>> DataHandler instead of byte[]. However since I'm building a contract-first
>>
>> webservice and using codegen, I can't do anything there.
>>
>>
>> I also implemented the suggestion that I should exclude '/services/*' in
>>
>> my UrlMappings to tell grails it shouldn't process what looks like
>>
>> attachments.
>>
>>
>> Does anyone have any suggestions?
>>
>>
>> R,
>>
>> rahul
>>
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

rsom@certifydatasystems.com
In reply to this post by marcopas
When you use 'cxf', what you get is a contract-last web service. If that works for you, i.e. for your requirement, it's perfect. Forget the rest.
If you need a contract-first web service only, you must use 'cxfjax'. Otherwise the wsdl generated by you does not completely match the wsdl you started with.

R,
rahul

On Mar 13, 2012, at 11:45 AM, Marco Pas wrote:

> Hi Ian,
>
> i restarted cleaned everything and started all over again..
>
> 1) generated the interface wsd2java using 'wsdl2java -fe jaxws21 -d
> <output-dir> -impl <location+wsdl file>
> 2) moved the interface and request and response stuff to the java src
> 3) implemented a service with the following
>
> class ConverterService implements CurrencyConvert {
>    static expose=['cxf']
>
>    ConversionResponse convert(ConversionRequest part1) {
>        println "inside the webservice call"
>        ConversionResponse resp = new ConversionResponse()
>        resp.setAmount(3.0f)
>        return resp
>    }
> }
>
> THIS Works :) so far... :) Do not know what i did wrong but the
> actuall Grails service is called by using SOAP-UI :)
> But whenever i try to use "static expose=['cxfjax']" i am loosing my
> request and response types.
> I tried to annotate the service with endpointInterface =
> "pkg.of.CurrencyConvert" with no luck..
>
> So far i can get away with the "static expose=['cxf]" annotation i
> guess, but still i am wondering why the webservice is loosing is
> request and response types when using
> "static expose=['cxfjax']"
>
> @WebService(
>    serviceName = "foobarService",
>    targetNamespace = "http://www.examplewebservice.com",
>    portName = "converterFooBarSoapPort",
>    endpointInterface = "com.examplewebservice.CurrencyConvert"
> )
> class ConverterService implements CurrencyConvert {
>
>    static expose=['cxfjax']
>
>    ConversionResponse convert(ConversionRequest part1) {
>        println "inside the webservice call"
>        ConversionResponse resp = new ConversionResponse()
>        resp.setAmount(3.0f)
>        return resp  //To change body of implemented methods use File
> | Settings | File Templates.
>    }
> }
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

marcopas
I really need a contract-first but when i use the 'cfxjax' i loose my
request and response types. Any idea?

2012/3/13 Rahul Somasunderam <[hidden email]>:

> When you use 'cxf', what you get is a contract-last web service. If that works for you, i.e. for your requirement, it's perfect. Forget the rest.
> If you need a contract-first web service only, you must use 'cxfjax'. Otherwise the wsdl generated by you does not completely match the wsdl you started with.
>
> R,
> rahul
>
> On Mar 13, 2012, at 11:45 AM, Marco Pas wrote:
>
>> Hi Ian,
>>
>> i restarted cleaned everything and started all over again..
>>
>> 1) generated the interface wsd2java using 'wsdl2java -fe jaxws21 -d
>> <output-dir> -impl <location+wsdl file>
>> 2) moved the interface and request and response stuff to the java src
>> 3) implemented a service with the following
>>
>> class ConverterService implements CurrencyConvert {
>>    static expose=['cxf']
>>
>>    ConversionResponse convert(ConversionRequest part1) {
>>        println "inside the webservice call"
>>        ConversionResponse resp = new ConversionResponse()
>>        resp.setAmount(3.0f)
>>        return resp
>>    }
>> }
>>
>> THIS Works :) so far... :) Do not know what i did wrong but the
>> actuall Grails service is called by using SOAP-UI :)
>> But whenever i try to use "static expose=['cxfjax']" i am loosing my
>> request and response types.
>> I tried to annotate the service with endpointInterface =
>> "pkg.of.CurrencyConvert" with no luck..
>>
>> So far i can get away with the "static expose=['cxf]" annotation i
>> guess, but still i am wondering why the webservice is loosing is
>> request and response types when using
>> "static expose=['cxfjax']"
>>
>> @WebService(
>>    serviceName = "foobarService",
>>    targetNamespace = "http://www.examplewebservice.com",
>>    portName = "converterFooBarSoapPort",
>>    endpointInterface = "com.examplewebservice.CurrencyConvert"
>> )
>> class ConverterService implements CurrencyConvert {
>>
>>    static expose=['cxfjax']
>>
>>    ConversionResponse convert(ConversionRequest part1) {
>>        println "inside the webservice call"
>>        ConversionResponse resp = new ConversionResponse()
>>        resp.setAmount(3.0f)
>>        return resp  //To change body of implemented methods use File
>> | Settings | File Templates.
>>    }
>> }
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: [Resolved] Grails + CXF + MTOM + Contract-first causes MIME boundary problems

ctoestreich
I know this issue is a bit out of scope, but in the new version we are explicitly binding for soap 1.2 using "http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true" encoding type.  I am curious if using the newest (v1.x+) of the plugin you are experiencing the same issue.