package com.l7tech.xml.soap;

import com.l7tech.message.HttpRequestKnob;
import com.l7tech.message.Message;
import com.l7tech.message.XmlKnob;
import com.l7tech.util.InvalidDocumentFormatException;
import com.l7tech.wsdl.Wsdl;
import java.io.IOException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;

class d implements f {
   private Element a;
   Boolean b;
   String c;
   final Wsdl val$wsdl;
   final XmlKnob val$requestXml;
   final Message val$request;

   d(Wsdl var1, XmlKnob var2, Message var3) {
      this.val$wsdl = var1;
      this.val$requestXml = var2;
      this.val$request = var3;
      this.a = null;
      this.b = null;
      this.c = null;
   }

   @Override
   public Wsdl getWsdl() {
      return this.val$wsdl;
   }

   @Override
   public Element getPayload() throws InvalidDocumentFormatException, IOException, SAXException {
      if (this.a == null) {
         Document var1 = this.val$requestXml.getDocumentReadOnly();
         this.a = SoapUtil.getPayloadElement(var1);
      }

      return this.a;
   }

   @Override
   public boolean hasHttpRequestKnob() throws IOException {
      if (this.b == null) {
         HttpRequestKnob var1 = this.val$request.getKnob(HttpRequestKnob.class);

         try {
            if (var1 == null) {
               this.b = Boolean.FALSE;
               return this.b;
            }
         } catch (IOException var2) {
            throw a(var2);
         }

         this.b = Boolean.TRUE;
         this.c = SoapUtil.stripQuotes(var1.getSoapAction());
      }

      return this.b;
   }

   @Override
   public String getSoapaction() {
      return this.c;
   }

   private static IOException a(IOException var0) {
      return var0;
   }
}
