On Tue, May 22, 2012 at 6:36 PM, eric johnson <ejjohn...@gmail.com> wrote:
> Thanks - the elementFormDefault isn't declared and I believe the
> default is unqualified.  I've played around quite a bit with those
> arguments for creating the OMNamespace and am less certain that is the
> cause of my error.

In that case you need to pass null as the OMNamespace when creating
the "document" element.

> I'm not sure why I am not getting an attachment back from the call.
> Is this even possible when working from the generated code in the
> skeleton?  I have found no complete examples of anyone using mtom to
> add an attachment to a response in this way.

You need to provide a bit more information about exactly what you are
attempting to do.

>
>
> On Tue, May 22, 2012 at 3:21 AM, Andreas Veithen
> <andreas.veit...@gmail.com> wrote:
>> The answer depends on the elementFormDefault declared on the schema.
>>
>> Andreas
>>
>> On Mon, May 21, 2012 at 10:10 PM, eric johnson <ejjohn...@gmail.com> wrote:
>>> Hi,
>>>
>>> I'm having some trouble adding an attachment to my response after
>>> attempting to follow the instructions here:
>>> http://axis.apache.org/axis2/java/core/docs/mtom-guide.html#
>>>
>>> The example from that url I am following is:
>>>
>>>         OMElement imageElement = fac.createOMElement("image", omNs);
>>>
>>>         // Creating the Data Handler for the file.  Any implementation of
>>>         // javax.activation.DataSource interface can fit here.
>>>         javax.activation.DataHandler dataHandler = new
>>> javax.activation.DataHandler(new FileDataSource("SomeFile"));
>>>
>>>         //create an OMText node with the above DataHandler and set
>>> optimized to true
>>>         OMText textData = fac.createOMText(dataHandler, true);
>>>
>>>         imageElement.addChild(textData);
>>>
>>>
>>> I suspect I am making a mistake in the creation of OMElement and
>>> OMNameSpace in my code below.
>>>
>>>       OMFactory factory = OMAbstractFactory.getOMFactory();
>>>       OMNamespace omNs = factory.createOMNamespace("I put the
>>> targetNamespace from the wsdl here", "ns");
>>>       OMElement documentElement = factory.createOMElement("document", omNs);
>>>       OMText textData = factory.createOMText(documentDataHandler, true);
>>>
>>>       documentElement.addChild(textData);
>>>
>>> So what should I be using for the URI and prefix values?  (I realize
>>> this is probably web services 101, but this is all new to me and a bit
>>> overwhelming).
>>>
>>> The document element is really part of a GetDocumentResponse type
>>> defined in my wsdl as:
>>>       <xs:element name="GetDocumentResponse"
>>> type="tns:GetDocumentResponseType" />
>>>
>>>       <xs:complexType name="GetDocumentResponseType">
>>>         <xs:sequence>
>>>           <xs:element name="mimeType" type="xs:string" minOccurs="1"
>>> maxOccurs="1"/>
>>>           <xs:element name="documentName" type="xs:string"
>>> minOccurs="1" maxOccurs="1"/>
>>>           <xs:element name="storageTimestamp" type="tns:sDateTime"
>>> minOccurs="1" maxOccurs="1"/>
>>>           <xs:element name="document" type="xs:base64Binary"
>>> minOccurs="1" maxOccurs="1"/>
>>>         </xs:sequence>
>>>       </xs:complexType>
>>>
>>> should I use "tns:GetDocumentResponse" for the prefix when creating
>>> the OMNamespace object?
>>>
>>> Should I be using the soap:address from the wsdl:service/wsdl:port as the 
>>> uri?
>>>
>>> Is there anything besides the code example I need to do to complete
>>> the addition of the attachment?
>>>
>>> Thanks!
>>>
>>> Eric
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
>>> For additional commands, e-mail: java-user-h...@axis.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
>> For additional commands, e-mail: java-user-h...@axis.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
> For additional commands, e-mail: java-user-h...@axis.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
For additional commands, e-mail: java-user-h...@axis.apache.org

Reply via email to