• gopivyas`
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 1
    Replies
Hi All,
 
I am trying to parse following stirng
<csclist><cscid>12345</cscid><cscid>6789</cscid>...</csclist>
 
I am getting the above xml in the form of string.
Here is what I am using
 

public void parsed (XmlStreamReader readr) {

String fin = 'Parsed foo values: ';

while (readr.hasNext()) {

if (readr.getEventType() == XmlTag.CHARACTERS) {

fin += readr.getText();

}

readr.next();

}

//return fin;

}

WebService static String CompanyLookup(String inputXML , String ownerid) {

XmlStreamReader reader = inputXML.getXmlStreamReader();

string result = parsed(inputXML);

//String result = parsed(inputXML);

string idout ='';

if(cscid == '' || cscid == null || ownerid =='' || ownerid == null)

{ throw new CustomException('<CSCSearchResult><Type>Site</Type><CSCID></CSCID><SFDCID></SFDCID><ErrorMsg>CSCSiteId/OwnerId can not be null</ErrorMsg></ CSCSearchResult>');

}

---------------

 

inputXML I am getting as a parameter in the webservice is an xml of the form STRING. I have writing a method to parse that string.

 

So now I have a question regarding how can I store the value of "CSCID" as an array(may be list)

2) how can I pass that XML string from my webservice. When I am trying to pass using

XmlStreamReader reader = inputXML.getXmlStreamReader();

string result = parsed(inputXML);

IT is giving me error."Method does not exist. Incorrect signature parse(inputXML)

Can anyone please tell me how to pass the xml (in the form of string ) to a parser which I have written on the top of web service.

 

Thanks,

Hi All,
 
I am trying to parse following stirng
<csclist><cscid>12345</cscid><cscid>6789</cscid>...</csclist>
 
I am getting the above xml in the form of string.
Here is what I am using
 

public void parsed (XmlStreamReader readr) {

String fin = 'Parsed foo values: ';

while (readr.hasNext()) {

if (readr.getEventType() == XmlTag.CHARACTERS) {

fin += readr.getText();

}

readr.next();

}

//return fin;

}

WebService static String CompanyLookup(String inputXML , String ownerid) {

XmlStreamReader reader = inputXML.getXmlStreamReader();

string result = parsed(inputXML);

//String result = parsed(inputXML);

string idout ='';

if(cscid == '' || cscid == null || ownerid =='' || ownerid == null)

{ throw new CustomException('<CSCSearchResult><Type>Site</Type><CSCID></CSCID><SFDCID></SFDCID><ErrorMsg>CSCSiteId/OwnerId can not be null</ErrorMsg></ CSCSearchResult>');

}

---------------

 

inputXML I am getting as a parameter in the webservice is an xml of the form STRING. I have writing a method to parse that string.

 

So now I have a question regarding how can I store the value of "CSCID" as an array(may be list)

2) how can I pass that XML string from my webservice. When I am trying to pass using

XmlStreamReader reader = inputXML.getXmlStreamReader();

string result = parsed(inputXML);

IT is giving me error."Method does not exist. Incorrect signature parse(inputXML)

Can anyone please tell me how to pass the xml (in the form of string ) to a parser which I have written on the top of web service.

 

Thanks,

gopi                     

Hi All,
 
I am trying to parse a xml string

String xmlString = <books><book>My Book</book><book>Your Book</book>....</books>

Based on the example given in the user guide I am little confused. Could not follow that example. Also I am trying to read the value of <book> . So now for exaple i got 5 different values for that ,, and now I want to run a query to check if those values existing in SFDC or not?

1) so can anyone please help me with how to read the above xml string thro' xmlStreamReader.

If possible please provide sample code

 

2) how can I run a query to find all the above values. Can it be doen in a single query. How can I do that?

 

This is really urgent. Any help would be really appreciated.

 

Thanks,

 

 

Hi,
 
I created a webservice which accepts 2 string parameters. These 2 parameters are passed from my Java client. Can anyone please tell me how can I declare those 2 variables and pass it to my webservice thro' my Java client. Do I have to create a seperate method just to declare 2 variable?
 
Any help will be really appreciated.
 
Thanks,
 
Hi All,
 
I am getting follwoing errors while doing the batch upload on opportunity obj.
 
Developer script exception from DuplicatelineOpptychange : DuplicatelineOpptychange: execution of BeforeUpdate  caused by: System.NullPointerException: Attempt to de-reference a null object  Class.DuplicatelineOpptyUpdate.opptyupdate: line 134, column 99
 
Here is my code:
 
public static  Opportunity[] opptyupdate(Opportunity[] opptyIds){

  System.debug('In opptyupdate public method of the UpdateOpptypkg class');
  System.debug('Processing ' + opptyIds.size() + ' opportunities');

//Get the partners name related to the changed opportunity
OpportunityPartner[] partner = [select AccountTo.Name, OpportunityId From OpportunityPartner WHERE OpportunityId in :opptyIds ];

//Get the Tech & Service name related to the changed oppty
OpportunityLineItem[] technologyentry = [Select PricebookEntry.ProductCode, PricebookEntry.Name, Mix__c , OpportunityId From OpportunityLineItem  where OpportunityId in: opptyIds order by Mix__c DESC];


Integer x1 =0;
Integer y1 =0;

for(x1=0;x1< opptyIds.size();x1++)
{
   String newPartnerString ='';

    for(y1=0; y1<partner.size();y1++)
     {
//THIS LOOP WILL FIND ALL THE PARTNERS RELATED TO THE EXISTING CHANGED OPPTY AND UPDATE THE PARTNER MERGE FIELD
if(partner[y1].OpportunityId == opptyIds[x1].Id && partner[y1].AccountToId != opptyIds[x1].AccountId && (opptyIds[x1].RecordTypeId == '0123000000003ykAAA' || opptyIds[x1].RecordTypeId == '012300000000CDLAA2') )
       
        {
                   if(newPartnerString == '')
                          {  newPartnerString += partner[y1].AccountTo.Name ;
                          }
                                         
                      else

                         { newPartnerString = newPartnerString + ';' + partner[y1].AccountTo.Name;
                         }
                                  
                 }

                   }                       
                   opptyIds[x1].Partners_Merge_Field__c = newPartnerString; //Set the new value of the merge field

       

String newservice1 ='';
String newservice2 ='';
    
       Integer q;

            for(q=0; q<technologyentry.size();q++)

//THIS LOOP WILL FIND ALL THE TECHNOLOGY AND SERVICE RELATED TO THE EXISTING CHANGED OPPTY AND UPDATE THE TECHNOLOGY AND SERVICE MERGE FIELD

    {
      if(technologyentry[q].OpportunityId == opptyIds[x1].Id )
         {
       
        if (technologyentry[q].PricebookEntry.ProductCode == 'Technology'&& (opptyIds[x1].RecordTypeId == '0123000000003ykAAA' || opptyIds[x1].RecordTypeId == '012300000000CDLAA2'))
            
             {    if(newservice1 == '')
                                          
                 { newservice1 += technologyentry[q].PricebookEntry.Name + ' (' + technologyentry[q].Mix__c.intValue()+ ')';
                 }
            else
                 { newservice1 = newservice1 + ';' + technologyentry[q].PricebookEntry.Name + ' (' + technologyentry[q].Mix__c.intValue() + ')';
                 }
              }

                  opptyIds[x1].Technology_Merge_Field__c = newservice1; //Set the new value of the merge field
              
                                                
          if (technologyentry[q].PricebookEntry.ProductCode == 'Service'&& (opptyIds[x1].RecordTypeId == '0123000000003ykAAA' || opptyIds[x1].RecordTypeId == '012300000000CDLAA2'))
                               
              {   if(newservice2 == '')
                      
                   { newservice2 += technologyentry[q].PricebookEntry.Name + ' (' + technologyentry[q].Mix__c.intValue() + ')';
                   }
             else
                   { newservice2 = newservice2 + ';' + technologyentry[q].PricebookEntry.Name + ' (' + technologyentry[q].Mix__c.intValue() + ')';
                   }

              }  
                 opptyIds[x1].Service_Merge_Field__c = newservice2; //Set the new value of the merge field
            
                               
             } //if for opptyid comparision with tech & service (opptyid)        

        }   //for tech loop      
 
           
    }//for loop for oppty
   
   
    Return  opptyIds ;
 
       
     }
   
  }
 
 
Can any one suggest why this is happening. This is really urgent to be solved. Any help would be appericiated.
 
Thanks,
 
Hi all,
 
I am getting an XML string which I wanted to parse. Basically this XML string has AccountID which I want to parse and use that accountid to do a lookup in Salesforce. Can anyone please tell me how to parse the incoming XML string and get the ID from that string.
Suppose this is the structure:
 <AList>

                        <AID>123456</AID>

                        <AID>78901</AID>

  </AList>

 

How can I parse this XML to get the ID. i.e 123456 and 78901? Basically I want to run a query based on this ID.

 

Any idea?

 

Thanks,

Gopi

Hi,
 
I created stubs using WSDL2Java and I placed those stubs in Eclipse. When I am going thro' those stubs it gives error for "java.util.vector".  I have all javamail, axis, quickstart, activation lib. so due to this "java.util.vector" error it gives error in my cliect file for serviceloactor and also for soapbinding.
 
Any idea why this is happening. do I need to install any other library?
 
Thanks,
Hi,
 
I created stubs using WSDL2Java and I placed those stubs in Eclipse. When I am going thro' those stubs it gives error for "java.util.vector".  I have all javamail, axis, quickstart, activation lib. so due to this "java.util.vector" error it gives error in my cliect file for serviceloactor and also for soapbinding.
 
Any idea why this is happening. do I need to install any other library?
 
Thanks,