This is a public Forum  publicRSS

Topic

    Tony William
    Incident File AttachmentAnswered
    Topic posted February 8, 2017 by Tony WilliamExpert, last edited February 9, 2017 
    69 Views, 6 Comments
    Title:
    Incident File Attachment
    Content:

    Hi all,

    I am working on an integration to add an attachment to an incident using SOAP from a external system, I created an xml and the incident is getting created by the attachment is not getting added
    I have added the code below for reference , can any body update me on what am i missing in the xml

    Code Block:

    Best Answer

    Dietrik

    As I said in my earlier post, move the fileattachment part to the top.

     That means not after the primarycontact tag  like the given example but after the create tag.

    My free advice is to use a tool to generate the soap messages, do not create them manually.

    Answer

     

    • Dietrik

      Do you create this xml manually and does it retune an error ? Try to have your soap message created with a java or c# test setup.

    • Tony William

      I am getting the below error

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
         <soapenv:Header/>
         <soapenv:Body>
            <soapenv:Fault>
               <faultcode>soapenv:Sender</faultcode>
               <faultstring>Data element in the Message is NULL</faultstring>
               <detail>
                  <fault>RightNowSyncService|urn:wsdl.ws.rightnow.com/v1_3 failed
      Found out-of-order or unrecognized node FileAttachments|urn:objects.ws.rightnow.com/v1_3 while parsing node of type Incident|urn:objects.ws.rightnow.com/v1_3
      Failed in constructing object CreateMsg : NULL input can not be deserialized
      Failed in setting value for element RNObjects array position 0 of object CreateMsg
      Failure in setting value for object Create element Create of type messages_ws_rightnow_com_v1_3::CreateMsg
      NULL returned from the Create deserializer due to missing or invalid XML</fault>
               </detail>
            </soapenv:Fault>
         </soapenv:Body>
      </soapenv:Envelope>

    • Dietrik

      You probably don't validate your message against the wsdl file.

      Try to change the order of the tags moving the fileattachment part to the top and get some tool to validate soap messages against their wsdl file instead of creating manually.

    • Narendra Muttineni

      Hi Tony,

      RightNow web services will follow certain order.i.e., Alphabetical order. So you have to construct web services in such away that the Fields should be in Alphabetical order.  

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="urn:messages.ws.rightnow.com/v1_3" xmlns:v11="urn:base.ws.rightnow.com/v1_3">
         <soapenv:Header>
            <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
               <wsse:UsernameToken >
                  <wsse:Username>login</wsse:Username>
                  <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">username</wsse:Password>
               </wsse:UsernameToken>
            </wsse:Security>
            <v1:ClientInfoHeader>
               <v1:AppID>Create Incident</v1:AppID>
            </v1:ClientInfoHeader>
         </soapenv:Header>
         <soapenv:Body>
              <ns7:Create xmlns:ns7="urn:messages.ws.rightnow.com/v1_3">
                  <ns7:RNObjects xmlns:ns4="urn:objects.ws.rightnow.com/v1_3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:Incident" xmlns:rnb="urn:base.ws.rightnow.com/v1_3">
                      <ns4:PrimaryContact>
           <ns4:Contact>
           <ID xmlns="urn:base.ws.rightnow.com/v1_3" id="462831" />
           </ns4:Contact>
           </ns4:PrimaryContact>
           <ns4:FileAttachments>
                  <ns4:FileAttachmentList action="add">
                      <ns4:Data>iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAbSURBVDhPY/hPImAgUf3/UQ3EhNhoKA2OUAIAr639H6lCmlsAAAAASUVORK5CYII=</ns4:Data>
                      <ns4:FileName>test.txt</ns4:FileName>
                  </ns4:FileAttachmentList>
           </ns4:FileAttachments>

           <ns4:Subject>Test chat to incident 1.</ns4:Subject>
              <ns4:Threads>
                  <ns4:ThreadList action='add'>
                      <ns4:Channel>
                          <rnb:Name>Chat</rnb:Name>
                      </ns4:Channel>
                          <ns4:EntryType>
                              <rnb:ID id='3'/>
                          </ns4:EntryType>
                          <ns4:Text>Chat Transcript</ns4:Text>
                  </ns4:ThreadList>
              </ns4:Threads>
             
           </ns7:RNObjects>
                  <ns7:ProcessingOptions>
                      <ns7:SuppressExternalEvents>false</ns7:SuppressExternalEvents>
                      <ns7:SuppressRules>false</ns7:SuppressRules>
                  </ns7:ProcessingOptions>
              </ns7:Create>
          </soapenv:Body>
      </soapenv:Envelope>

      Please let me know if it doesn't work for you.

      Thanks,

      Narendra

    • Dietrik

      As I said in my earlier post, move the fileattachment part to the top.

       That means not after the primarycontact tag  like the given example but after the create tag.

      My free advice is to use a tool to generate the soap messages, do not create them manually.

    • Tony William

      Thankyou Dietrik and Narendra for you comments
      Dietrik I made the changes according to you comment I got it workingyes