Other HPE Product Questions
1748259 Members
3873 Online
108760 Solutions
New Discussion

download and upload attachments in HPSM9

 
karges
Occasional Visitor

download and upload attachments in HPSM9

hi

 i havea hava program which imports a WSDL generated for HP sm9. am able to get all the other details like status assignment group etc. this webservice is created for incidnet module.

now am struck with  dowbnload and upload an attachment kindly help me , the getattaachment methof of the instance is returning nothign for an incident. but in real the incident has attachments below is the code 

import java.io.File;
import java.nio.file.Files;

import com.hp.schemas.SM._7.RetrieveSherpaRequest;
import com.hp.schemas.SM._7.RetrieveSherpaResponse;
import com.hp.schemas.SM._7.SherpaInstanceType;
import com.hp.schemas.SM._7.SherpaKeysType;
import com.hp.schemas.SM._7.SherpaModelType;
import com.hp.schemas.SM._7.SherpaProxy;
import com.hp.schemas.SM._7.UpdateSherpaRequest;
import com.hp.schemas.SM._7.UpdateSherpaResponse;
import com.hp.schemas.SM._7.Common.AttachmentType;
import com.hp.schemas.SM._7.Common.StringType;
import com.hp.schemas.SM._7.Common.AttachmentType;

 

public class retrive_incident {
@SuppressWarnings("null")
public static void main(String[] args) throws Exception {

RetrieveSherpaRequest retrive_inc = new RetrieveSherpaRequest();
retrive_inc.setAttachmentInfo(null);
retrive_inc.setAttachmentData(null);
retrive_inc.setIgnoreEmptyElements(true);
retrive_inc.setUpdatecounter(null);
retrive_inc.setHandle(null);
retrive_inc.setCount(null);
retrive_inc.setStart(null);
SherpaInstanceType inc_instance = new SherpaInstanceType();
inc_instance.setQuery(null);
inc_instance.setUniquequery(null);
inc_instance.setRecordid(null);
inc_instance.setUpdatecounter(null);

StringType inc_id = new StringType();
inc_id.set_value("IM66913777");
SherpaKeysType keys_samp = new SherpaKeysType();
keys_samp.setIncidentID(inc_id);
keys_samp.setQuery("");
keys_samp.setUpdatecounter(null);
SherpaModelType model_samp = new SherpaModelType();
model_samp.setQuery("");
model_samp.setKeys(keys_samp);
model_samp.setInstance(inc_instance);
retrive_inc.setModel(model_samp);


//update_sherpa update_incidnet = new update_sherpa();
//update_incidnet.upadte_sherpa_incident();
SherpaProxy incd_proxy = new SherpaProxy();;

((javax.xml.rpc.Stub) incd_proxy.getSherpa_PortType())._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, "sherpa");
((javax.xml.rpc.Stub) incd_proxy.getSherpa_PortType())._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, "sherpa");
RetrieveSherpaResponse response = incd_proxy.retrieveSherpa(retrive_inc);

AttachmentType attchment = new AttachmentType();
System.out.println("before cmpletion");
String a = response.getModel().getInstance().getAttachments()[0].getHref();
System.out.println("entering cmpletion");
System.out.println(a + " completed");

}

}

1 REPLY 1
Dennis Handly
Acclaimed Contributor

Re: download and upload attachments in MF SM9

This is the wrong company for MF software questions. You need to register in the MF Software Forum:
https://community.softwaregrp.com/t5/Service-Manager-Service-Center/bd-p/itrc-695