12 Replies Latest reply on Jan 17, 2007 4:14 PM by dlofthouse

    Soap with Attachments and document/literal

    dlofthouse

      I have just been looking at http://jira.jboss.com/jira/browse/JBWS-269, I am trying to see how much work will be involved to add support for attachments to wstools. I just wanted to check that my understanding of the current status of the Swa implementation is correct.

      From what I can see support for mapping attachments to parameters is complete for RPC/literal.

      For document/literal it is not possible to map the attachments to message parameters, the only way to handle attachments with document/literal is to use the 'org.jboss.ws.core.jaxrpc.StubExt' API on the client as shown in http://jira.jboss.org/jira/browse/JBWS-1384 and on the server side use the SOAPMessageContext to get the attachment.

      Is this correct? Do we plan to support mapping to parameters for document/literal endpoints?

        • 1. Re: Soap with Attachments and document/literal
          jason.greene

          There is support for document/literal attachments. You can have multiple parts as long as there is only one part bound to the soap body. So attachments and headers can also be included. The jaxrpc-mapping.xml file doesnt have a way to indicate attachments, so the way this is determined is by the binding section in the wsdl file.

          • 2. Re: Soap with Attachments and document/literal
            dlofthouse

            How about the mapping of the attachment to the parameters of the method on the SEI?

            At the moment on the server side the only way I see to get access to the attachment is to use the SOAPMessage class and call the getAttachments method.

            On the client side it apears that the only way to send the attachments is to use the 'org.jboss.ws.core.jaxrpc.StubExt' interface as described in JBWS-1384.

            At the moment in the class JAXRPCMetaDataBuilder there is a comment: -


            // we don't support swa binding parameters in document style
            // http://jira.jboss.org/jira/browse/JBWS-1384


            Is this something we will support? At the moment deployments created using wscompile can not be deployed because we do not process the mapping defined.



            • 3. Re: Soap with Attachments and document/literal
              jason.greene

              That's wrong. This has been supported before, it's supposed to work.

              I reopened the issue.

              • 4. Re: Soap with Attachments and document/literal
                dlofthouse

                That's good, my understanding matches yours - I thought we had full support for attachments and it was just tools that needed enhancing then I found that comment.

                • 5. Re: Soap with Attachments and document/literal
                  jason.greene

                  I will revert the patch that disabled this, and take a look and see if there are any bugs with doc/lit attachments, but the use case that that jira issue was testing was using an invalid WSDL file, so this may have been the real problem.

                  • 6. Re: Soap with Attachments and document/literal
                    dlofthouse

                    I think the original WSDL at the top of the user post is correct, the basic profile only specifies that the part must reference elements if the part is referenced from a soapbind:body element, it doesn't specify a requirement for mime:content parts.

                    R2204 A document-literal binding in a DESCRIPTION MUST refer, in each of its soapbind:body element(s), only to wsdl:part element(s) that have been defined using the element attribute.


                    The attachments profile also contains the following parts defined in a document/literal example: -

                    <wsdl:message name="ClaimIn">
                     <wsdl:part name="body" element="types:ClaimDetail"/>
                     <wsdl:part name="ClaimPhoto" type="xsd:base64Binary"/>
                    </wsdl:message>
                    


                    • 7. Re: Soap with Attachments and document/literal
                      jason.greene

                      Yes, you are right R2910 in AP 1.0 explicitly allows both. I was mixing swa ref requirements. Anyway I will make sure this is handled correctly.

                      • 8. Re: Soap with Attachments and document/literal
                        jason.greene

                        I just fixed support for this in trunk. See the JBWS-1384 test case.

                        • 9. Re: Soap with Attachments and document/literal
                          dlofthouse

                          I am just trying to deploy another example I was looking at based on the original test for JBWS-1384. My WSDL defines the attachment but it is not mapped to any parameters on the SEI - The endpoint accesses the attachment through the SOAPMessage class.

                          However deployment now fails with the following error: -

                          20:07:03,480 ERROR [ServiceEndpointDeployer] Cannot create service endpoint
                          org.jboss.ws.WSException: Cannot obtain method parameter mapping for message part 'mimepart' in wsdl operation: publishPhoto
                          at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCMetaDataBuilder.buildInputParameter(JAXRPCMetaDataBuilder.java:245)
                          at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCMetaDataBuilder.processBindingParameters(JAXRPCMetaDataBuilder.java:395)
                          at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCMetaDataBuilder.buildParameterMetaDataDoc(JAXRPCMetaDataBuilder.java:867)
                          at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCMetaDataBuilder.setupOperationsFromWSDL(JAXRPCMetaDataBuilder.java:215)
                          at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCServerMetaDataBuilder.buildMetaData(JAXRPCServerMetaDataBuilder.java:219)
                          at org.jboss.ws.core.server.ServiceEndpointDeployer.create(ServiceEndpointDeployer.java:81)
                          at org.jboss.ws.integration.jboss42.DeployerInterceptor.createServiceEndpoint(DeployerInterceptor.java:127)
                          at org.jboss.ws.integration.jboss42.DeployerInterceptorJSE.createServiceEndpoint(DeployerInterceptorJSE.java:130)
                          at org.jboss.ws.integration.jboss42.DeployerInterceptor.create(DeployerInterceptor.java:78)
                          at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180)
                          at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91)
                          at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                          at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                          at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)


                          Does this now mean that all attachments need to be mapped or should we be allowing them to be unmapped so if no mapping is found the attachment can just be retrieved using the SOAPMessage class? I can take a look if it is the latter, I am just really trying to build up a picture of all the ways attachments can be mapped so I can this into account in wstools.


                          • 10. Re: Soap with Attachments and document/literal
                            dlofthouse

                            Related to my last post should we be able to support complex types that contain elements of type swaRef?

                            Taking the following extract from my WSDL: -

                             <schema targetNamespace='http://www.jboss.org/support/photoalbum/types'
                             xmlns='http://www.w3.org/2001/XMLSchema'
                             xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'
                             xmlns:tns='http://www.jboss.org/support/photoalbum/types'
                             xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
                             <complexType name='Photo'>
                             <sequence>
                             <element name='caption' nillable='true' type='string'/>
                             <element name='image' nillable='true' type='string'/>
                             </sequence>
                             </complexType>
                             <element name='publishPhoto' type='tns:Photo'/>
                             <element name='publishPhotoResponse' type='int'/>
                             </schema>
                             </types>
                            
                             <message name='AlbumEndpoint_publishPhoto'>
                             <part element='ns1:publishPhoto' name='publishPhoto'/>
                             <part name='mimepart' type='xsd:hexBinary'/>
                             </message>


                            If swaRef is supported I would have though that mapping the attachment to a parameter on the SEI should be mandatory as in this case the swaRef can reference the attachment instead.


                            • 11. Re: Soap with Attachments and document/literal
                              dlofthouse

                              Forget that, that is the wrong WSDL extract.

                              • 12. Re: Soap with Attachments and document/literal
                                dlofthouse

                                Here is the correct extract: -

                                <schema targetNamespace='http://www.jboss.org/support/photoalbum/types'
                                 xmlns='http://www.w3.org/2001/XMLSchema'
                                 xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'
                                 xmlns:tns='http://www.jboss.org/support/photoalbum/types'
                                 xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
                                 xmlns:ref='http://ws-i.org/profiles/basic/1.1/xsd'>
                                 <complexType name='Photo'>
                                 <sequence>
                                 <element name='caption' nillable='true' type='string'/>
                                 <element name='image' type='ref:swaRef'/>
                                 </sequence>
                                 </complexType>
                                 <element name='publishPhoto' type='tns:Photo'/>
                                 <element name='publishPhotoResponse' type='int'/>
                                 </schema>
                                 </types>
                                
                                 <message name='AlbumEndpoint_publishPhoto'>
                                 <part element='ns1:publishPhoto' name='publishPhoto'/>
                                 <part name='mimepart' type='xsd:hexBinary'/>
                                 </message>