Service Manager / Service Center Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

How to clear values using Web Service ?

SOLVED
Go to Solution
Occasional Advisor

How to clear values using Web Service ?

Hi gurus,

 

   I search for any tip for setting NULL value (clear previous value of attribute) using calling Web Services. I have default setting of WSDL (is generated automatically), where:

 

a) all Update Request methods have following element:

<xs:attribute default="true" name="ignoreEmptyElements" type="xs:boolean" use="optional"/>

   so I update only attributes which I specify in Update Request. All other attributes is ignored (not change its values).

 

b) all attributes in InstanceType has enabled parameter "nillable":

<xs:element minOccurs="0" name="MobilePhone" nillable="true" type="cmn:StringType"/>
<xs:element minOccurs="0" name="Manager" nillable="true" type="cmn:StringType"/>
<xs:element minOccurs="0" name="ValidFrom" nillable="true" type="cmn:DateTimeType"/>
<xs:element minOccurs="0" name="ValidTo" nillable="true" type="cmn:DateTimeType"/>

   so all this attributes can be set as NULL

 

But I don't know how to. In all documents which I read is following statement:

<Manager xsi:nil="true"/>

 where xsi namespace is defined as:

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

 

All my attempts were not successful and all attributes which I set to "nil" was unchanged and still has same value.

 

There is a Update Request code one of my attempt:

Spoiler
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pws="http://servicecenter.peregrine.com/PWS" xmlns:com="http://servicecenter.peregrine.com/PWS/Common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header/>
   <soapenv:Body>
      <pws:UpdateIdMContactRequest ignoreEmptyElements="true">
         <pws:model>
            <pws:keys>
               <pws:ContactID type="String">87695</pws:ContactID>
            </pws:keys>
            <pws:instance>
               <pws:ModifyTimestamp type="DateTime">2014-01-14T07:21:07+00:00</pws:ModifyTimestamp>
		<pws:MobilePhone type="String" xsi:nil="true"/>
		<pws:ValidTo type="DateTime" xsi:nil="true"/>
            </pws:instance>
         </pws:model>
      </pws:UpdateIdMContactRequest>
   </soapenv:Body>
</soapenv:Envelope>

 All attributes with specific value (as a ModifiedTime) was successfully updated. All attributes with nil value was ignored.

 

Thanks for any advice and yours experience with deleting values.

 

Lukas

 

5 REPLIES
Occasional Advisor

Re: How to clear values using Web Service ?

Pls,

 

   is there someone who use deleting values using SOAP API (extaccess) ? How to delete some value in any SM field ?

 

Thanks a lot for some ideas,

 

Lukas

Honored Contributor Honored Contributor

Re: How to clear values using Web Service ?

Hi,

 

My knowledge of web services is very limited, so I can't offer a solution through that method, but if web services is updating a ticket, can't you just null the field through the relevant formatctrl if the update comes from web services.  I'm not sure what in your environment identifies updates through web services, but perhaps something like this:

 

update: $G.ess

Calculation: field in $file=NULL

 

Audrey

Occasional Advisor

Re: How to clear values using Web Service ?

Hi Audrey,

 

   thank you for your reaction. It's fine you like to help but this is not exactly what I was looking for.

 

1) condition at Format Control: you really can catch this "WS Updates" but not using variable $G.ess (this identifies that client is using ESS portal access) but variable $G.bg is the right (bg as background identifies that request is not from Web/Java client but i.e. from external access)

 

2) expression at FC: can be used if you know which field you want to clear (fixed specification) but I don't know which field of course. This specification is in the Web Service request.

BTW: If I would like to clear specific attribute I can realize it in the "expression" tab of extaccess record not in the "calculation" tab of FC.

 

So if SM get a WS request to clear attribute X I want to process: "X in $L.file=NULL"

if SM get a WS request to clear attribute Y I want to process: "Y in $L.file=NULL" etc.

 

But this expressions must to realize SM automatically when receive the WS request as any other WS attribute update.

 

Thanks for any other advices how to send WS request to clear specific attribute, Lukas

Highlighted
HPE Expert

Re: How to clear values using Web Service ?

It can be fixed with "ignoreEmptyElements="false" " XML attribute.

see "customer notes" of QCCR1E83886 "SM handles JournalUpdates incorrectly in an UpdateIncidentRequest Web services call when there is an empty line in JournalUpdates".

 

List the fields you want to celar in the XML request, with "ignoreEmptyElements="false" " XML attribute, then these fields will be cleared.

HPE Expert

Re: How to clear values using Web Service ?

Hi Frank,

 

QCCR1E83886 is a defect found before product release and it has been fixed when product was released, so it's not customer visible. Other information in your reply is correct and it should have answered the question in this discussion.

Cheers :)
Yan Tong (Serene), HP Software Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution; and give kudo if you like it :)