1

我正在尝试将此 SOAP 发布到我们的 Web 服务中,它会返回信息,但我希望它创建一张票。老实说,我对此完全陌生,我已经尝试了一切,并在谷歌上搜索了一切,任何想法都会很棒。我正在使用 powershell 3.0。

这是肥皂

    <?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:s0="urn:HPD_IncidentInterface_Create_WS">
  <soap:Header>
    <s0:AuthenticationInfo>
      <s0:userName>******</s0:userName>
      <s0:password>******</s0:password>
      <s0:authentication/>
    </s0:AuthenticationInfo>
  </soap:Header>
  <soap:Body>
    <s0:HelpDesk_Submit_Service>
      <s0:Assigned_Group>TTG Service Desk</s0:Assigned_Group>
      <s0:Assigned_Support_Company>********* Services</s0:Assigned_Support_Company>
      <s0:Assigned_Support_Organization>ICT and IS</s0:Assigned_Support_Organization>
      <s0:Assignee>*********</s0:Assignee>
      <s0:Categorization_Tier_1>Unlock</s0:Categorization_Tier_1>
      <s0:Categorization_Tier_2>Account</s0:Categorization_Tier_2>
      <s0:Categorization_Tier_3>Access Denied</s0:Categorization_Tier_3>
      <s0:First_Name>Inbound</s0:First_Name>
      <s0:Impact>4-Minor/Localized</s0:Impact>
      <s0:Last_Name>Email</s0:Last_Name>
      <s0:Product_Categorization_Tier_1>Software</s0:Product_Categorization_Tier_1>
      <s0:Product_Categorization_Tier_2>Software Application/System</s0:Product_Categorization_Tier_2>
      <s0:Product_Categorization_Tier_3>Application Platform</s0:Product_Categorization_Tier_3>
      <s0:Product_Name>Active Directory - OPAL</s0:Product_Name>
      <s0:Reported_Source>Direct Input</s0:Reported_Source>
      <s0:Resolution>Password reset</s0:Resolution>
      <s0:Service_Type>User Service Request</s0:Service_Type>
      <s0:Status>Resolved</s0:Status>
      <s0:Action>CREATE</s0:Action>
      <s0:Summary>Password Reset - OPAL</s0:Summary>
      <s0:Notes>Password Reset - OPAL</s0:Notes>
      <s0:Urgency>4-Low</s0:Urgency>
      <s0:Status_Reason>No Further Action Required</s0:Status_Reason>
    </s0:HelpDesk_Submit_Service>
  </soap:Body>
</soap:Envelope>

它返回这个

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:HPD_IncidentInterface_Create_WS" xmlns:s0="urn:HPD_IncidentInterface_Create_WS" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <wsdl:types>
  <xsd:schema elementFormDefault="qualified" targetNamespace="urn:HPD_IncidentInterface_Create_WS">
   <xsd:element name="HelpDesk_Submit_Service" type="s0:CreateInputMap"/>
   <xsd:complexType name="CreateInputMap">
    <xsd:sequence>
     <xsd:element minOccurs="0" name="Assigned_Group" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Assigned_Group_Shift_Name" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Assigned_Support_Company" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Assigned_Support_Organization" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Assignee" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Categorization_Tier_1" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Categorization_Tier_2" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Categorization_Tier_3" type="xsd:string"/>
     <xsd:element minOccurs="0" name="CI_Name" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Closure_Manufacturer" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Closure_Product_Category_Tier1" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Closure_Product_Category_Tier2" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Closure_Product_Category_Tier3" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Closure_Product_Model_Version" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Closure_Product_Name" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Department" type="xsd:string"/>
     <xsd:element name="First_Name" type="xsd:string"/>
     <xsd:element name="Impact" type="s0:ImpactType"/>
     <xsd:element name="Last_Name" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Lookup_Keyword" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Manufacturer" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Product_Categorization_Tier_1" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Product_Categorization_Tier_2" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Product_Categorization_Tier_3" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Product_Model_Version" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Product_Name" type="xsd:string"/>
     <xsd:element name="Reported_Source" type="s0:Reported_SourceType"/>
     <xsd:element minOccurs="0" name="Resolution" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Resolution_Category_Tier_1" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Resolution_Category_Tier_2" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Resolution_Category_Tier_3" type="xsd:string"/>
     <xsd:element name="Service_Type" type="s0:Service_TypeType"/>
     <xsd:element name="Status" type="s0:StatusType"/>
     <xsd:element name="Action" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Create_Request" type="s0:Create_RequestType"/>
     <xsd:element name="Summary" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Notes" type="xsd:string"/>
     <xsd:element name="Urgency" type="s0:UrgencyType"/>
     <xsd:element minOccurs="0" name="Work_Info_Summary" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Work_Info_Notes" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Work_Info_Type" type="s0:Work_Info_TypeType"/>
     <xsd:element minOccurs="0" name="Work_Info_Date" type="xsd:dateTime"/>
     <xsd:element minOccurs="0" name="Work_Info_Source" type="s0:Work_Info_SourceType"/>
     <xsd:element minOccurs="0" name="Work_Info_Locked" type="s0:Create_RequestType"/>
     <xsd:element minOccurs="0" name="Work_Info_View_Access" type="s0:Work_Info_View_AccessType"/>
     <xsd:element minOccurs="0" name="Middle_Initial" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Status_Reason" type="s0:Status_ReasonType"/>
     <xsd:element minOccurs="0" name="Direct_Contact_First_Name" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Direct_Contact_Middle_Initial" type="xsd:string"/>
     <xsd:element minOccurs="0" name="Direct_Contact_Last_Name" type="xsd:string"/>
     <xsd:element minOccurs="0" name="TemplateID" type="xsd:string"/>
     <xsd:element minOccurs="0" name="ServiceCI" type="xsd:string"/>
     <xsd:element minOccurs="0" name="ServiceCI_ReconID" type="xsd:string"/>
     <xsd:element minOccurs="0" name="HPD_CI" type="xsd:string"/>
     <xsd:element minOccurs="0" name="HPD_CI_ReconID" type="xsd:string"/>
     <xsd:element minOccurs="0" name="HPD_CI_FormName" type="xsd:string"/>
     <xsd:element minOccurs="0" name="WorkInfoAttachment1Name" type="xsd:string"/>
     <xsd:element minOccurs="0" name="WorkInfoAttachment1Data" type="xsd:base64Binary"/>
     <xsd:element minOccurs="0" name="WorkInfoAttachment1OrigSize" type="xsd:int"/>
    </xsd:sequence>
   </xsd:complexType>
   <xsd:simpleType name="ImpactType">
    <xsd:restriction base="xsd:string">
     <xsd:enumeration value="1-Extensive/Widespread"/>
     <xsd:enumeration value="2-Significant/Large"/>
     <xsd:enumeration value="3-Moderate/Limited"/>
     <xsd:enumeration value="4-Minor/Localized"/>
    </xsd:restriction>
   </xsd:simpleType>
   <xsd:simpleType name="Reported_SourceType">
    <xsd:restriction base="xsd:string">
     <xsd:enumeration value="Direct Input"/>
     <xsd:enumeration value="Email"/>
     <xsd:enumeration value="External Escalation"/>
     <xsd:enumeration value="Fax"/>
     <xsd:enumeration value="Systems Management"/>
     <xsd:enumeration value="Phone"/>
     <xsd:enumeration value="Voice Mail"/>
     <xsd:enumeration value="Walk In"/>
     <xsd:enumeration value="Web"/>
     <xsd:enumeration value="Other"/>
    </xsd:restriction>
   </xsd:simpleType>
   <xsd:simpleType name="Service_TypeType">
    <xsd:restriction base="xsd:string">
     <xsd:enumeration value="User Service Restoration"/>
     <xsd:enumeration value="User Service Request"/>
     <xsd:enumeration value="Infrastructure Restoration"/>
     <xsd:enumeration value="Infrastructure Event"/>
    </xsd:restriction>
   </xsd:simpleType>
   <xsd:simpleType name="StatusType">
    <xsd:restriction base="xsd:string">
     <xsd:enumeration value="New"/>
     <xsd:enumeration value="Assigned"/>
     <xsd:enumeration value="In Progress"/>
     <xsd:enumeration value="Pending"/>
     <xsd:enumeration value="Resolved"/>
     <xsd:enumeration value="Closed"/>
     <xsd:enumeration value="Cancelled"/>
    </xsd:restriction>
   </xsd:simpleType>
   <xsd:simpleType name="Create_RequestType">
    <xsd:restriction base="xsd:string">
     <xsd:enumeration value="Yes"/>
     <xsd:enumeration value="No"/>
    </xsd:restriction>
   </xsd:simpleType>
   <xsd:simpleType name="UrgencyType">
    <xsd:restriction base="xsd:string">
     <xsd:enumeration value="1-Critical"/>
     <xsd:enumeration value="2-High"/>
     <xsd:enumeration value="3-Medium"/>
     <xsd:enumeration value="4-Low"/>
    </xsd:restriction>
   </xsd:simpleType>
   <xsd:simpleType name="Work_Info_TypeType">
    <xsd:restriction base="xsd:string">
     <xsd:enumeration value="----- Customer Inbound -----"/>
     <xsd:enumeration value="Customer Communication"/>
     <xsd:enumeration value="Customer Follow-up"/>
     <xsd:enumeration value="Customer Status Update"/>
     <xsd:enumeration value="----- Customer Outbound -----"/>
     <xsd:enumeration value="Closure Follow Up"/>
     <xsd:enumeration value="Detail Clarification"/>
     <xsd:enumeration value="General Information"/>
     <xsd:enumeration value="Resolution Communications"/>
     <xsd:enumeration value="Satisfaction Survey"/>
     <xsd:enumeration value="Status Update"/>
     <xsd:enumeration value="----- General -----"/>
     <xsd:enumeration value="Incident Task / Action"/>
     <xsd:enumeration value="Problem Script"/>
     <xsd:enumeration value="Working Log"/>
     <xsd:enumeration value="Email System"/>
     <xsd:enumeration value="Paging System"/>
    </xsd:restriction>
   </xsd:simpleType>
   <xsd:simpleType name="Work_Info_SourceType">
    <xsd:restriction base="xsd:string">
     <xsd:enumeration value="Email"/>
     <xsd:enumeration value="Fax"/>
     <xsd:enumeration value="Phone"/>
     <xsd:enumeration value="Voice Mail"/>
     <xsd:enumeration value="Walk In"/>
     <xsd:enumeration value="Pager"/>
     <xsd:enumeration value="System Assignment"/>
     <xsd:enumeration value="Web"/>
     <xsd:enumeration value="Other"/>
    </xsd:restriction>
   </xsd:simpleType>
   <xsd:simpleType name="Work_Info_View_AccessType">
    <xsd:restriction base="xsd:string">
     <xsd:enumeration value="Internal"/>
     <xsd:enumeration value="Public"/>
    </xsd:restriction>
   </xsd:simpleType>
   <xsd:simpleType name="Status_ReasonType">
    <xsd:restriction base="xsd:string">
     <xsd:enumeration value="Infrastructure Change Created"/>
     <xsd:enumeration value="Local Site Action Required"/>
     <xsd:enumeration value="Purchase Order Approval"/>
     <xsd:enumeration value="Registration Approval"/>
     <xsd:enumeration value="Supplier Delivery"/>
     <xsd:enumeration value="Support Contact Hold"/>
     <xsd:enumeration value="Third Party Vendor Action Reqd"/>
     <xsd:enumeration value="Client Action Required"/>
     <xsd:enumeration value="Infrastructure Change"/>
     <xsd:enumeration value="Request"/>
     <xsd:enumeration value="Future Enhancement"/>
     <xsd:enumeration value="Pending Original Incident"/>
     <xsd:enumeration value="Client Hold"/>
     <xsd:enumeration value="Monitoring Incident"/>
     <xsd:enumeration value="Customer Follow-Up Required"/>
     <xsd:enumeration value="Temporary Corrective Action"/>
     <xsd:enumeration value="No Further Action Required"/>
     <xsd:enumeration value="Resolved by Original Incident"/>
     <xsd:enumeration value="Automated Resolution Reported"/>
     <xsd:enumeration value="No longer a Causal CI"/>
    </xsd:restriction>
   </xsd:simpleType>
   <xsd:element name="HelpDesk_Submit_ServiceResponse" type="s0:CreateOutputMap"/>
   <xsd:complexType name="CreateOutputMap">
    <xsd:sequence>
     <xsd:element name="Incident_Number" type="xsd:string"/>
    </xsd:sequence>
   </xsd:complexType>
   <xsd:element name="AuthenticationInfo" type="s0:AuthenticationInfo"/>
   <xsd:complexType name="AuthenticationInfo">
    <xsd:sequence>
     <xsd:element name="userName" type="xsd:string"/>
     <xsd:element name="password" type="xsd:string"/>
     <xsd:element minOccurs="0" name="authentication" type="xsd:string"/>
     <xsd:element minOccurs="0" name="locale" type="xsd:string"/>
     <xsd:element minOccurs="0" name="timeZone" type="xsd:string"/>
    </xsd:sequence>
   </xsd:complexType>
  </xsd:schema>
 </wsdl:types>

   <wsdl:message name="ARAuthenticate">

      <wsdl:part element="s0:AuthenticationInfo" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="HelpDesk_Submit_ServiceSoapIn">

      <wsdl:part element="s0:HelpDesk_Submit_Service" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="HelpDesk_Submit_ServiceSoapOut">

      <wsdl:part element="s0:HelpDesk_Submit_ServiceResponse" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:portType name="HPD_IncidentInterface_Create_WSPortTypePortType">

      <wsdl:operation name="HelpDesk_Submit_Service">

         <wsdl:input message="s0:HelpDesk_Submit_ServiceSoapIn">

       </wsdl:input>

         <wsdl:output message="s0:HelpDesk_Submit_ServiceSoapOut">

       </wsdl:output>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="HPD_IncidentInterface_Create_WSPortTypeSoapBinding" type="s0:HPD_IncidentInterface_Create_WSPortTypePortType">

      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="HelpDesk_Submit_Service">

         <soap:operation soapAction="urn:HPD_IncidentInterface_Create_WS/HelpDesk_Submit_Service" style="document"/>

         <wsdl:input>

            <soap:header message="s0:ARAuthenticate" part="parameters" use="literal">

            </soap:header>

            <soap:body use="literal"/>

         </wsdl:input>

         <wsdl:output>

            <soap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="HPD_IncidentInterface_Create_WSService">

  <wsdl:documentation>
HelpDesk_Submit_Service Create  </wsdl:documentation>

      <wsdl:port binding="s0:HPD_IncidentInterface_Create_WSPortTypeSoapBinding" name="HPD_IncidentInterface_Create_WSPortTypeSoap">

         <soap:address location="http://rem-dev05/arsys/services/ARService?server=rem-dev05&amp;webService=HPD_IncidentInterface_Create_WS"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>

但它应该返回这样的东西

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <ns0:HelpDesk_Submit_ServiceResponse xmlns:ns0="urn:HPD_IncidentInterface_Create_WS" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <ns0:Incident_Number>INC000000572219</ns0:Incident_Number>
    </ns0:HelpDesk_Submit_ServiceResponse>
  </soapenv:Body>
</soapenv:Envelope>

我正在运行的 powershell 命令是:

Invoke-WebRequest http://rem-dev05/arsys/WSDL/public/rem-dev05/HPD_IncidentInterface_Create_WS -method POST -InFile C:\Passwords\Logs\ticket.xml

并且 xml 文件包含顶部的第一个代码....抱歉,如果我没有提供正确的信息或错过了一些重要的信息。我最初试图通过 VBA 来做到这一点,因为这是我的代码在 Outlook 中作为宏的来源......

无论如何,任何人的帮助都会很棒。

4

1 回答 1

0
function Execute-GetDocumentList
( 
    [Xml]    $SOAPRequest, 
    [String] $URL 
) 
{ 
    write-host "Sending SOAP Request To Server: $URL" 
    $soapWebRequest = [System.Net.WebRequest]::Create($URL)   
    $soapWebRequest.Headers.Add("SOAPAction",
     "`"/.././listDocuments`"") ("Find end point")






    $soapWebRequest.ContentType = "text/xml;charset=`"utf-8`"" 
    $soapWebRequest.Method      = "POST" 

    write-host "Initiating Send." 
    $requestStream = $soapWebRequest.GetRequestStream() 
    $SOAPRequest.Save($requestStream) 
    $requestStream.Close() 

    write-host "Send Complete, Waiting For Response." 
    $resp = $soapWebRequest.GetResponse() 
    $responseStream = $resp.GetResponseStream() 
    $soapReader = [System.IO.StreamReader]($responseStream) 
    $ReturnXml = [Xml] $soapReader.ReadToEnd() 
    $responseStream.Close() 
    write-host "Response Received."
    return $ReturnXml 

  }



  $soap = [xml]@"
 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 xmlns:s0="urn:HPD_IncidentInterface_Create_WS">
<soap:Header>
<s0:AuthenticationInfo>
  <s0:userName>******</s0:userName>
  <s0:password>******</s0:password>
  <s0:authentication/>
</s0:AuthenticationInfo>
</soap:Header>
<soap:Body>
<s0:HelpDesk_Submit_Service>
  <s0:Assigned_Group>TTG Service Desk</s0:Assigned_Group>
  <s0:Assigned_Support_Company>********* Services</s0:Assigned_Support_Company>
  <s0:Assigned_Support_Organization>ICT and IS</s0:Assigned_Support_Organization>
  <s0:Assignee>*********</s0:Assignee>
  <s0:Categorization_Tier_1>Unlock</s0:Categorization_Tier_1>
  <s0:Categorization_Tier_2>Account</s0:Categorization_Tier_2>
  <s0:Categorization_Tier_3>Access Denied</s0:Categorization_Tier_3>
  <s0:First_Name>Inbound</s0:First_Name>
  <s0:Impact>4-Minor/Localized</s0:Impact>
  <s0:Last_Name>Email</s0:Last_Name>
  <s0:Product_Categorization_Tier_1>Software</s0:Product_Categorization_Tier_1>
  <s0:Product_Categorization_Tier_2>Software 
  Application/System</s0:Product_Categorization_Tier_2>
  <s0:Product_Categorization_Tier_3>Application 
  Platform</s0:Product_Categorization_Tier_3>
  <s0:Product_Name>Active Directory - OPAL</s0:Product_Name>
  <s0:Reported_Source>Direct Input</s0:Reported_Source>
  <s0:Resolution>Password reset</s0:Resolution>
  <s0:Service_Type>User Service Request</s0:Service_Type>
  <s0:Status>Resolved</s0:Status>
  <s0:Action>CREATE</s0:Action>
  <s0:Summary>Password Reset - OPAL</s0:Summary>
  <s0:Notes>Password Reset - OPAL</s0:Notes>
  <s0:Urgency>4-Low</s0:Urgency>
  <s0:Status_Reason>No Further Action Required</s0:Status_Reason>
  </s0:HelpDesk_Submit_Service>
  </soap:Body>
</soap:Envelope>
 "@
$ret = Execute-GetDocumentList $soap 
 "https://u/...../Service? 
  WSDL"
  #$Token_ListDocument = $ret.Envelope.Header.Authentication.SecurityToken

 $s=$ret.Envelope.Body.InnerXml | ft
  $s

  #or

  $document = $xmls.DocumentElement.ChildNodes
于 2019-04-25T12:55:52.883 回答