Question

Does anyone know how I can process Maximo response from a Maximo Query web service ?

I'm able to get a dataset response back from Maximo, however when I try and get the work order attributes (example WONUM, SITEID etc...), all attributes are returned as null.

Below is the code I'm using, any help is appreciated.

       MXWO_WORKORDERType wo_add = new MXWO_WORKORDERType();

        MXWO_WORKORDERType[] wo_results;

        DateTime creationDateTime = new DateTime();
        bool creationDateTimeSpecified = false;
        string language = "NoDef";
        string transLanguage = "NoDef";
        string messageID = "NoDef";
        string maximoVersion = "NoDef";
        bool uniqueResult = false;
        string maxItems = "10000";
        string rsStart = "0";
        string rsCount = "NoDef";
        string rsTotal = "NoDef";

        MXStringType mxstringStID = new MXStringType();
        MXStringType mxstringstatus = new MXStringType();
        MXStringType mxstringwonum = new MXStringType();



        // create query from string 
        MXWOQueryType query = new MXWOQueryType();

        query.WHERE = ("SITEID = 'ABC' AND STATUS='WAPPR'");



         MXWOPortTypeClient c = new MXWOPortTypeClient("MXWOSOAP1Port");



        // perform query 


        MXWO_WORKORDERType[] returnedWOs = c.QueryMXWO(query, ref creationDateTime, ref language, ref transLanguage, ref messageID, ref maximoVersion, uniqueResult, maxItems, ref rsStart, out rsCount, out rsTotal);            

       MXWO_WORKORDERType wo = null;



       for (int i = 0; i < returnedWOs.Length; i++)
       {



           mxstringwonum.Value = returnedWOs[i].WONUM.Value;

           wo.WONUM = mxstringwonum;


           MessageBox.Show(mxstringwonum.Value);



       }
Was it helpful?

Solution 2

Thanks Shreyuth. I tweaked your code and code from other articles and got it working. Below is the final code. Thanks for your response/help.

        DateTime creationDateTime = new DateTime();
        bool creationDateTimeSpecified = false;
        string language = "NoDef";
        string transLanguage = "NoDef";
        string messageID = "NoDef";
        string maximoVersion = "NoDef";
        bool uniqueResult = false;
        string maxItems = "10000";
        string rsStart = "0";
        string rsCount = "NoDef";
        string rsTotal = "NoDef";

        MXStringType mxstringStID = new MXStringType();
        MXStringType mxstringwonum = new MXStringType();
        MXStringType mxDescription = new MXStringType();


        Uri serviceUri = new Uri("http://maximourl/meaweb/services/testservice");           
        BasicHttpBinding serviceBinding = new BasicHttpBinding();
        EndpointAddress EndPoint = new EndpointAddress(serviceUri);

        ChannelFactory<MXWOPortTypeChannel> channelFactory = new ChannelFactory<MXWOPortTypeChannel>(serviceBinding, EndPoint);

        //Create a channel 
        MXWOPortTypeChannel channel = channelFactory.CreateChannel();

        channel.Open();

        MXWOQueryType query1 = new MXWOQueryType();

        query1.WHERE = ("SITEID = 'ABC' AND STATUS='APPR'");


        QueryMXWOResponse resp1 = new QueryMXWOResponse();



        QueryMXWORequest creq = new QueryMXWORequest();

        creq.baseLanguage = language;
        //creq.creationDateTime = creationDateTime;
        creq.maximoVersion = maximoVersion;
        creq.transLanguage = transLanguage;
        creq.messageID = messageID;
        creq.rsStart = rsStart;
        creq.maxItems = maxItems;
        creq.uniqueResult = uniqueResult;

        creq.MXWOQuery = query1;


        resp1 = channel.QueryMXWO(creq);

        MXWO_WORKORDERType[] results = resp1.MXWOSet;



        for (int i = 0; i < results.Length; i++)
        {

            MXWO_WORKORDERType wt = results[i];

            mxstringwonum.Value = results[i].WONUM.Value;
            wt.WONUM.Value = mxstringwonum.Value;

            mxDescription.Value = results[i].DESCRIPTION.Value;
            wt.DESCRIPTION.Value = mxDescription.Value;

            mxstringStID.Value = results[i].SITEID.Value;
            wt.SITEID.Value = mxstringStID.Value;


           MessageBox.Show(mxstringStID.Value + " -- " + mxstringwonum.Value + " -- " + mxDescription.Value);

      }

OTHER TIPS

Check this

 MXWO proxy = new MXWO();
        MXWO_WORKORDERType[] wo_results;
        MXWO_WORKORDERType[] wo_new = new MXWO_WORKORDERType[1];
        DateTime creationDateTime = new DateTime();
        WebServiceUseCases.com.cts.ctsinpunvemscoe_MXWO.MXStringQueryType[] queryName = new com.cts.ctsinpunvemscoe_MXWO.MXStringQueryType[1];
        queryName[0] = new com.cts.ctsinpunvemscoe_MXWO.MXStringQueryType();
        queryName[0].Value = "";
        WebServiceUseCases.com.cts.ctsinpunvemscoe_MXWO.MXDomainQueryType[] queryStatus = new com.cts.ctsinpunvemscoe_MXWO.MXDomainQueryType[1];
        queryStatus[0] = new com.cts.ctsinpunvemscoe_MXWO.MXDomainQueryType();
        queryStatus[0].Value = "";
        MXWOQueryType query = new MXWOQueryType();
        query.WORKORDER = new MXWOQueryTypeWORKORDER();
        if (txtBoxWOName.Text != "")
        {
            queryName[0].Value = txtBoxWOName.Text;
            query.WORKORDER.WONUM = queryName;
        }
        if (cmBoxStatus.SelectedIndex != 0)
        {
            queryStatus[0].Value = cmBoxStatus.SelectedItem.ToString();
            query.WORKORDER.STATUS = queryStatus;
        }

        proxy.Url = "http://<server name>:<port>/meaweb/services/MXWO";

        bool creationDateTimeSpecified = false;
        string language = "en";
        string transLanguage = "en";
        string messageID = "NoDef";
        string maximoVersion = "NoDef";
        bool uniqueResult = false;
        string maxItems = "2000";
        string rsStart = "0";
        string rsCount = "NoDef";
        string rsTotal = "NoDef";

        wo_results = proxy.QueryMXWO(query, ref creationDateTime, ref creationDateTimeSpecified, ref language,
        ref transLanguage, ref messageID, ref maximoVersion, uniqueResult, maxItems, ref rsStart, out rsCount, out rsTotal);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top