public static Message GetItemAttributes(this Message message, HttpConnectorConfiguration plentyConfig)
 {
     return(message
            .LoadToken(plentyConfig)
            .LoadModuleResourceXml <Module>(@"PlentyConfig.xml")
            .VariableToPayload("Token")
            .XslTransformFromModuleResource <GetItemAttributesModule>("ItemAttributes/Login2GetItemAttributes.xsl")
            .SetVariable("HttpHeadersSoapAction", "GetItemAttributes")
            .HttpPostMessage(plentyConfig, "")
            );
 }
示例#2
0
 public static Message LoadToken(this Message message, HttpConnectorConfiguration plentyConfig)
 {
     return(message
            .LoadTempToken()
            .If(m => m.Variables.ContainsKey("Token") &&
                !string.IsNullOrEmpty((string)m.Variables["Token"]))
            .Then(Message.NoChange)
            .Else(m =>
                  m
                  .SetPayload(Resources.LoadModuleResourceXml <Module>(@"PlentyConfig.xml"))
                  .ClearVariables()
                  .XslTransformFromModuleResource <Module>(@"GetToken/GetTokenTransform.xsl")
                  .SetVariable("HttpHeaderSoapAction", "GetAuthentificationToken")
                  .LogDebug(me => String.Format("Configured Request:\r\n{0}", me))
                  .HttpPostMessage(plentyConfig, "")
                  .LogDebug(me => String.Format("Received Response:\r\n{0}", me))
                  .ClearVariables()
                  .ExtractVariable("//Token", "Token")
                  .SaveTempToken()
                  )
            .EndIf()
            );
 }