Re: WS RetrieveIncident attachment href attribute user agent dependent -why? (401 Views)
Reply
Occasional Collector
soderla
Posts: 4
Registered: ‎02-08-2013
Message 1 of 6 (482 Views)

WS RetrieveIncident attachment href attribute user agent dependent -why?

[ Edited ]

Hi!

 

I am experiencing some odd (to me) behavior using the SOAP WS.

When issuing a request via SoapUI the response of RetrieveIncident includes attachments the way I would expect it. Does mean in case of an attachment the element has a href attribute with the content id information to extract it out of the mime multipart response. 

If I issue the very same request via a Java program using the Axis (1.4) library the attachment element in the response doesn't contain the href attribute.

After some comparison I figured out that this behavior is driven by the user agent information present in the HTTP request. If I set the user agent in the java program to the one SOAP UI communicates the href attribute is present.

 

My understanding of SwA would be that the href is the standard way to reference attachments. Can you explain to me what the reasoning is behind this behavior? Is my understanding of SwA incorrect?

 

My scenario is a java program which is interfacing to webservices in a generic way and HP SM is one use case. This means I expect webservices responses which are SOAP with Attachments to have a href attribute, containing the content id, on the element which describes the attachment in the SOAP response body.

 

To summarize: Why does the attachment element in the response have a href attribute containing the content id ONLY if the user agent in the request is NOT like "Axis*"?

 

I am using HP SM Server 9.20.021 build 021

 

Thank you for your help!

 

Request via SoapUI:

POST http://foo:13080/SM/7/ws HTTP/1.1
Content-Type: text/xml;charset=UTF-8
SOAPAction: "Retrieve"
Content-Length: 647
Host: foo:13080
Proxy-Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Cookie: JSESSIONID=24A545C09ED9CA3DB0D57E14A4D7F58C
Cookie2: $Version=1
Authorization: Basic U3lzdGVtLkFkbWluOg==

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <ns3:RetrieveIncidentRequest attachmentInfo="true" attachmentData="true" ignoreEmptyElements="true" xmlns:ns3="http://schemas.hp.com/SM/7">
         <ns3:model>
            <ns3:keys>
               <ns3:IncidentID mandatory="false" readonly="false"/>
            </ns3:keys>
            <ns3:instance>
               <ns3:IncidentID type="string" mandatory="false" readonly="false">IM10005</ns3:IncidentID>
            </ns3:instance>
         </ns3:model>
      </ns3:RetrieveIncidentRequest>
   </soapenv:Body>
</soapenv:Envelope>

 

Response (attachment excerpt only) via SoapUI - href attribute present as expected:

<cmn:attachment href="cid:5112aae197934926efde50e8" len="77" name="foo.txt" type="text/plain" xmime:contentType="text/plain"/></attachments>

 

Request via Axis:

POST http://foo:13080/SM/7/ws HTTP/1.1
User-Agent: Axis/1.4
Content-Type: text/xml;charset=UTF-8
SOAPAction: "Retrieve"
Content-Length: 647
Host: foo:13080
Proxy-Connection: Keep-Alive
Authorization: Basic U3lzdGVtLkFkbWluOg==

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <ns3:RetrieveIncidentRequest attachmentInfo="true" attachmentData="true" ignoreEmptyElements="true" xmlns:ns3="http://schemas.hp.com/SM/7">
         <ns3:model>
            <ns3:keys>
               <ns3:IncidentID mandatory="false" readonly="false"/>
            </ns3:keys>
            <ns3:instance>
               <ns3:IncidentID type="string" mandatory="false" readonly="false">IM10005</ns3:IncidentID>
            </ns3:instance>
         </ns3:model>
      </ns3:RetrieveIncidentRequest>
   </soapenv:Body>
</soapenv:Envelope>

 Response (attachment excerpt only) via Axis - no href attribute:

<cmn:attachment contentId="cid:5112aae197934926efde50e8" len="77" name="foo.txt" type="text/plain" xmime:contentType="text/plain"/></attachments>

 

Honored Contributor
Abhijit K
Posts: 903
Registered: ‎10-14-2010
Message 2 of 6 (467 Views)

Re: WS RetrieveIncident attachment href attribute user agent dependent -why?

Hi,

 

 I dont know what exactly you are looking for but below thread has example to retrieve attachment from webservices:

 

http://h30499.www3.hp.com/t5/HP-Service-Manager-Service/Attachment-and-Webservice/m-p/5354705#M78840

 

Hope this might be helpful for you.

 

 

regards,

Abhijit K

Occasional Collector
soderla
Posts: 4
Registered: ‎02-08-2013
Message 3 of 6 (463 Views)

Re: WS RetrieveIncident attachment href attribute user agent dependent -why?

Thank you for the link. I already read this post and I do know how to retrieve the attachments. To emphasize what I am looking for I edited my orginial post and highlighted the question.

Honored Contributor
Abhijit K
Posts: 903
Registered: ‎10-14-2010
Message 4 of 6 (455 Views)

Re: WS RetrieveIncident attachment href attribute user agent dependent -why?

As I metioned in given link, attachments are stored in different table and each record in attachment table has id i guess href attribute has attachment id for that ticket from attachment table.

If you go to attachments table you can see the ID there.


Regards,
Abhijit K
Occasional Collector
soderla
Posts: 4
Registered: ‎02-08-2013
Message 5 of 6 (449 Views)

Re: WS RetrieveIncident attachment href attribute user agent dependent -why?

Thank you for your reply, but this doesn't answer my question. Maybe it helps if I explain my scenario in more detail. I therefore updated my post.

Occasional Collector
soderla
Posts: 4
Registered: ‎02-08-2013
Message 6 of 6 (401 Views)

Re: WS RetrieveIncident attachment href attribute user agent dependent -why?

Has anyone an idea where to adress this question to, to get an answer?

Thank you!

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.