1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.api.dsmlv2.actions;
21
22
23 import java.io.IOException;
24
25 import org.apache.directory.api.dsmlv2.Dsmlv2Container;
26 import org.apache.directory.api.dsmlv2.Dsmlv2StatesEnum;
27 import org.apache.directory.api.dsmlv2.GrammarAction;
28 import org.xmlpull.v1.XmlPullParser;
29 import org.xmlpull.v1.XmlPullParserException;
30
31
32
33
34
35
36
37 public class ReadSoapHeader extends GrammarAction
38 {
39
40
41
42 public ReadSoapHeader()
43 {
44 super( "Reads SOAP header" );
45 }
46
47
48
49
50
51 @Override
52 public void action( Dsmlv2Container container ) throws XmlPullParserException
53 {
54 try
55 {
56 XmlPullParser xpp = container.getParser();
57 StringBuilder sb = new StringBuilder();
58
59 String startTag = xpp.getText();
60 sb.append( startTag );
61
62
63 startTag = startTag.substring( 1, startTag.length() - 1 );
64
65 int tagType;
66 String endTag = "";
67
68
69
70 while ( !startTag.equals( endTag ) )
71 {
72 tagType = xpp.next();
73 endTag = xpp.getText();
74 sb.append( endTag );
75
76 if ( tagType == XmlPullParser.END_TAG )
77 {
78
79 endTag = endTag.substring( 2, endTag.length() - 1 );
80 }
81 }
82
83
84 container.setState( Dsmlv2StatesEnum.SOAP_HEADER_END_TAG );
85 }
86 catch ( IOException e )
87 {
88 e.printStackTrace();
89 }
90 }
91 }