Skip to content


AXIS2 ADB base64binary problem

I look today into problem “Unexpected element”. Developer use a code generation utility wsdl2java for AXIS2. Everything working fine except attachments. Service call fail with exception “Unexpected element attachment”.  I found that element attachment is successfully start to processing, but fail to finished. The problem in the code:

	if (reader.isStartElement() && new javax.xml.namespace.QName("http://company.com/service/model/v1", "attachment").equals(reader.getName()))
	{
		reader.next();
		if (isReaderMTOMAware(reader) && java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_BINARY)))
		{
			//MTOM aware reader - get the datahandler directly and put it in the object
			object.setAttachment((javax.activation.DataHandler) reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER));
		}
		else
		{
			if ((reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT) && reader.getName()
				.equals( new javax.xml.namespace.QName(org.apache.axiom.om.impl.MTOMConstants.XOP_NAMESPACE_URI,
						org.apache.axiom.om.impl.MTOMConstants.XOP_INCLUDE)))
			{
				final java.lang.String id = org.apache.axiom.om.util.ElementHelper.getContentID(reader, "UTF-8");
				object.setAttachment(((org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder) ((org.apache.axiom.om.impl.llom.OMStAXWrapper) reader).getBuilder()).getDataHandler(id));
				reader.next();

				reader.next();

			}
			else if (reader.hasText())
			{
                               String content = reader.getText();
				object.setAttachment(org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content));
			}
		}
		reader.next();
	} // End of if for expected property start element

We don’t use MTOM, so problem was in section

else if (reader.hasText()){

Looking into reader data I found that content of element “attachment” contains multiple text nodes, but expected only one node. It seams that parser reads base64binary not in one piece, but multiple chunks.
So instead I use next code:

  else if (reader.hasText()) {
            String content = "";
            while(reader.hasText()){
                content+=reader.getText();
                reader.next();
            }
         object.setAttachment(org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content));
   }

Now all working as expected.

Posted in development.

Tagged with , , .


204.124.182.252 – spamers from http://gordoarsnaui.com/

http://gordoarsnaui.com/  Registered by mandios.com

204.124.182.252 is from United States(US) in region North America

OrgName:    VolumeDrive
OrgID:      VOLUM-2
Address:    1143 Northern Blvd
City:       Clarks Summit
StateProv:  PA
PostalCode: 18411
Country:    US

NetRange:   204.124.180.0 - 204.124.183.255
CIDR:       204.124.180.0/22
OriginAS:   AS46664
NetName:    VOLUMEDRIVE
NetHandle:  NET-204-124-180-0-1
Parent:     NET-204-0-0-0-0
NetType:    Direct Allocation
NameServer: DNS1.VOLUMEDRIVE.COM
NameServer: DNS2.VOLUMEDRIVE.COM
Comment:    http://www.volumedrive.com
RegDate:    2009-01-22
Updated:    2009-01-22

RAbuseHandle: VOLUM-ARIN
RAbuseName:   VolumeDrive
RAbusePhone:  +1-862-266-1083
RAbuseEmail:  info@volumedrive.com 

RNOCHandle: VOLUM-ARIN
RNOCName:   VolumeDrive
RNOCPhone:  +1-862-266-1083
RNOCEmail:  info@volumedrive.com 

RTechHandle: JBO223-ARIN
RTechName:   Bohanon, Josh
RTechPhone:  +1-862-266-1083
RTechEmail:  info@volumedrive.com 

OrgTechHandle: JBO223-ARIN
OrgTechName:   Bohanon, Josh
OrgTechPhone:  +1-862-266-1083
OrgTechEmail:  info@volumedrive.com

Posted in security.

Tagged with .


Post comments

I found some suspicious comments posted to pages few days ago. So I add some code to trace this kind of activity and starting from today I will post it under a tag “suspicious_activity”. It was a bot.

Comment in blog: 2010/02/18 at 11:27am
IP:213.21.34.82
AGENT:"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"

request= "Post comment"={
 comment="4FD8s9  <a href=\"http://ldwwtdlacbzq.com/\">ldwwtdlacbzq</a>, [url=http://gystknfeqthm.com/]gystknfeqthm[/url], [link=http://wcgdyvrtxjct.com/]wcgdyvrtxjct[/link], http://akzoniynxfvt.com/";
 author="svppaezbf";
 email="daoqgi@sgtohi.com";
 url="http://qvjngtzfuwgq.com/";


4FD8s9 ldwwtdlacbzq, [url=http://gystknfeqthm.com/]gystknfeqthm[/url], [link=http://wcgdyvrtxjct.com/]wcgdyvrtxjct[/link], http://akzoniynxfvt.com/

came from 213.21.34.82

inetnum:        213.21.0.0 - 213.21.63.255
netname:        RU-DDCOM-20080218
descr:          Demos Datacom
country:        RU
org:            ORG-DD5-RIPE
admin-c:        SES53-RIPE
tech-c:         VLAD2-RIPE
status:         ALLOCATED PA
mnt-by:         RIPE-NCC-HM-MNT
mnt-lower:      DDCOM-MNT
mnt-routes:     DDCOM-MNT
source:         RIPE # Filtered

inetnum:        213.21.0.0 - 213.21.63.255
netname:        RU-DDCOM-20080218
descr:          Demos Datacom
country:        RU
org:            ORG-DD5-RIPE
admin-c:        SES53-RIPE
tech-c:         VLAD2-RIPE
status:         ALLOCATED PA
mnt-by:         RIPE-NCC-HM-MNT
mnt-lower:      DDCOM-MNT
mnt-routes:     DDCOM-MNT
source:         RIPE # Filtered

inetnum:        85.235.192.0 - 85.235.196.255
netname:        PROMETEY-BBNET-1
descr:          Prometey backbone network
country:        RU
admin-c:        SPEC1-RIPE
tech-c:         SPEC1-RIPE
status:         ASSIGNED PA
mnt-by:         PROMETEY-MNT
source:         RIPE # Filtered

inetnum:        87.251.152.0 - 87.251.152.255
netname:        Saltar-In2
descr:          Network of Saltar-Telecom
descr:          Russia, Moskow
country:        RU
admin-c:        SVA79-RIPE
tech-c:         SVA79-RIPE
status:         ASSIGNED PA
mnt-by:         SALTAR-MNT
source:         RIPE # Filtered

inetnum:        81.91.176.0 - 81.91.177.255
netname:        ANDERS-EQ
descr:          Anders BG
country:        RU
admin-c:        ABN4-RIPE
tech-c:         ABN4-RIPE
mnt-by:         RU-ANDERS-MNT
status:         ASSIGNED PA
source:         RIPE # Filtered


% This is the RIPE Database query service.
% The objects are in RPSL format.
%
% The RIPE Database is subject to Terms and Conditions.
% See http://www.ripe.net/db/support/db-terms-conditions.pdf

% Note: This output has been filtered.
%       To receive output for a database update, use the "-B" flag.

% Information related to '213.21.0.0 - 213.21.63.255'

inetnum:         213.21.0.0 - 213.21.63.255
netname:         RU-DDCOM-20080218
descr:           Demos Datacom
country:         RU
org:             ORG-DD5-RIPE
admin-c:         SES53-RIPE
tech-c:          VLAD2-RIPE
status:          ALLOCATED PA
mnt-by:          RIPE-NCC-HM-MNT
mnt-lower:       DDCOM-MNT
mnt-routes:      DDCOM-MNT
source:          RIPE # Filtered

organisation:    ORG-DD5-RIPE
org-name:        Demos Datacom
org-type:        LIR
address:         Demos Datacom
 Euegene Serebryakov
 82 Pavlovskaya
 196650 Saint-Petersburg, Kolpino
 RUSSIAN FEDERATION
phone:           +78124611028
fax-no:          +78124611028
e-mail:          ses@kspd.ru
admin-c:         SES53-RIPE
mnt-ref:         RIPE-NCC-HM-MNT
mnt-by:          RIPE-NCC-HM-MNT
source:          RIPE # Filtered

person:          Eugene Serebryakov
address:         Demos Datacom, Ltd.
address:         Pavlovskaya, 82
address:         196650, Saint-Petersburg, RU
phone:           +78124611028
phone:           +78124562024
phone:           +79618035970
fax-no:          +78124611028
nic-hdl:         SES53-RIPE
source:          RIPE # Filtered

person:          Vladimir Popov
address:         Demos Datacom, Ltd.
address:         Pavlovskaya, 82
address:         196650, Saint-Petersburg, Kolpino, RU
phone:           +78124611028
phone:           +78124562024
phone:           +79618035980
nic-hdl:         VLAD2-RIPE
source:          RIPE # Filtered

% Information related to '213.21.0.0/18AS44720'

route:           213.21.0.0/18
descr:           RU-DDCOM-20080903
origin:          AS44720
mnt-by:          DDCOM-MNT
source:          RIPE # Filtered

% Information related to '213.21.32.0/22AS44720'

route:           213.21.32.0/22
descr:           RU-DDCOM-Part-ANNC-Prometey
origin:          AS44720
mnt-by:          DDCOM-MNT
source:          RIPE # Filtered

Posted in development, security.

Tagged with .


Start

I have a collection of snippets or chunks of code that I could reuse rather than recreate from scratch. It 99% chance that will be update, “improved” while reuse, but at least I have a something to start. Not so far ago I lost part of collection that was stored and decide to organize it online. I have a space on shared hosting where I do some experiments, so I decide  to use it. Also found that Word press could save me some time as engine to hold content.  If you found the information here helpful to you, you could use it. I am not expected that you comment, but if you would like to leave it – do that.  If you found some problem in code  – leave a comment.

Posted in Uncategorized.

Tagged with .