assetmoveSingleAsset operation and the standard web service

Maximo’s web service library can consist of services that are created from an Object Stucture, Enterprise Service or a Standard Service. A Standard Service is just that, it’s an OOTB service that is prebuilt and predefined. There are roughly 10 or so predefined standard services that range from ASSET to WORKORDER to TICKET. These services all have a predefined set of operations, for example, the WORKORDER has three operations. They are, “workorderchangeStatus”, “workorderstartWorkOrder” and “workordernotifyBPELStatus”. The ASSET has only one operation called “assetmoveSingleAsset”. This operation does one thing and it just moves an asset to another location. This post will show you how to use these standard services (“assetmoveSingleAsset” in particular) and the trouble I went through trying to use this operation.

First off, creating the web service is no different than creating one from an Object Structure or and Enterprise Service, except with the Standard Service, you don’t have to create any kind of object before you deploy because it’s already built for you. So do create the ASSET Standard Service, go to your Web Service Library and click on Select Action -> Create Web Service -> Create WS from Standard Service. You will see a list of predefined objects. Select ASSET and click Create. Now you can deploy the service. You can then access the WSDL at this URL

http://<servername>:<port>/meaweb/wsdl/ASSET.wsdl

On a side note, if you need help with the setting up the MIF, here are some articles that may help you.

The web services here don’t require that the MIF be setup. You can just use the web service library out of the box, provided that you set the ‘mxe.int.webappurl’ in the System Properties settings.

Once you have the web service deployed, you can use your favorite SOAP tool to test it. I use SoapUI. Once you have your favorite tool open, create a new project and create a new SOAP request. Here is what the WSDL request looks like:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:max="http://www.ibm.com/maximo">
   <soap:Header/>
   <soap:Body>
      <max:assetmoveSingleAsset creationDateTime="?" baseLanguage="?" transLanguage="?" messageID="?" maximoVersion="?">
         <!--Optional:-->
         <max:asset>
            <!--Optional:-->
            <max:ASSET>
               <max:SITEID changed="?">?</max:SITEID>
               <max:ASSETNUM changed="?">?</max:ASSETNUM>
            </max:ASSET>
        </max:asset>
        <!--Optional:-->
        <max:newLocation>?</max:newLocation>
        <!--Optional:-->
        <max:newSite>?</max:newSite>
        <!--Optional:-->
        <max:newParent>?</max:newParent>
      </max:assetmoveSingleAsset>
   </soap:Body>
</soap:Envelope>

This request seems pretty straight forward and it is for the most part. In order to send a request, you simply have to fill in a few fields. Even though it says that some of the fields are optional, you must provide an ASSETNUM and a SITEID for the ASSET object. You must also provide a value for the ‘newLocation’, ‘newSite’. The ‘newParent’ is truly an optional field.

Once you have those filled in, go ahead and send the request to the server. If you don’t have any errors, then go into Maximo and check to make sure that everything worked. You can go and check the move history of the asset and so forth.

Now here’s the tricky part. If you were like me and didn’t get an error and the asset location didn’t change, then you just so happened to pick an asset number that didn’t quite update the asset you wanted to update. Let me explain, if you used ASSETNUM 0002 to test your operation, it updated a different asset where the ASSETNUM contained the value ‘0002’. For example, in my case it updated a different asset with an ASSETNUM of FE000025. See how this assetnum contains 0002? Now, you are wondering, why would it update asset FE000025 and not 0002? Well first, let find out why it took that assetnum and not some other asset that contained 0002 in the ID.

First open the Asset module and filter by ASSETNUM by entering 0002 (or whatever value you used) in the field list and hit enter. In my scenario, FE000025 in the first on in the list of many assets that contained the value 0002. The asset I wanted to find was 10 rows down the line. So in your case, check the first asset in your list and I’m 100% sure that that is the asset who’s location was changed through your test SOAP request.

Ok, so now that we know what happened, how do we fix it? Well, first the schema that generated the above XML request for us is missing a valuable XML attribute for the ASSETNUM property. It is missing the ‘operator’ attribute. This specifies how to query for the ASSETNUM that you just entered. Some values for the operator attribute are: =, >, <, >=, <=. In our case, we want to set this attribute to = (equals) because we want to update the exact ASSETNUM we enter for this property. So avoid further confusion, your final SOAP message should look like the following:


<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:max="http://www.ibm.com/maximo">
   <soap:Header/>
   <soap:Body>
      <max:assetmoveSingleAsset>
         <max:asset>
            <max:ASSET>
               <max:SITEID>BEDFORD</max:SITEID>
               <max:ASSETNUM operator="=">0002</max:ASSETNUM>
            </max:ASSET>
        </max:asset>
        <max:newLocation>WAKEFIELD</max:newLocation>
        <max:newSite>BEDFORD</max:newSite>
      </max:assetmoveSingleAsset>
   </soap:Body>
</soap:Envelope>

Series Navigation
This entry is part [part not set] of 5 in the series Web Services

Did You Know...

As Maximo Experts, we have developed several add-on products for Maximo that mobilize the work force, simplifies assignments, provides ad-hoc reporting capabilities and facilitates the seamless integration of Service Requests into Maximo.

Check out our products by clicking on the following links: EZMaxMobile, EZMaxPlanner and EZMaxRequest.

Find Out More

Leave a Reply