API Subscription Issue

Forum for users and developers of Bullhorn's Webservices API suite

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
alihumad
User
Posts: 12
Joined: Fri Apr 08, 2011 1:40 pm

API Subscription Issue

Post by alihumad » Wed Jul 06, 2011 12:27 pm

Hi,

I'm having a problem with subscribing to the Bullhorn eventSubscribe operation so I can listen to events for when new jobOrders are created, edited or deleted.

Following is the code I'm using and the error I'm getting.

Public Sub createSubscription()

Dim subscriptionID As String = "hirestrategyEvents"
Dim entityList As String = "JobOrder"

' Store comma separated list of entities in array

Dim splitArray As String() = Nothing
splitArray = entityList.Split(",")

' set up event subscription criteria
Dim criteria As New entityEventSubscriptionCriteria()
criteria.entityNames = splitArray

' Subscribe to event
Dim res As apiEventsSubscribeResult = service.eventsSubscribe(APIsession, subscriptionID, criteria)
APIsession = res.session
Response.Write("Subscription: " & res.subscriptionMetaData.subscriptionId & "<br />Created on: " & res.subscriptionMetaData.createdOn)
End Sub

Error:
java.lang.NullPointerException
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.Services.Protocols.SoapException: java.lang.NullPointerException

Source Error:

Line 1055: [return: System.Xml.Serialization.XmlElementAttribute("return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
Line 1056: public apiEventsSubscribeResult eventsSubscribe([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] apiSession session, [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string subscriptionId, [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] subscriptionCriteria criteria) {
Line 1057: object[] results = this.Invoke("eventsSubscribe", new object[] {
Line 1058: session,
Line 1059: subscriptionId,


Is there a way you can let me know what I’m doing wrong?

Thanks

apsmith
Site Admin
Posts: 2051
Joined: Wed Dec 31, 1969 8:00 pm

Re: API Subscription Issue

Post by apsmith » Wed Jul 06, 2011 2:30 pm

Alihumad,

This looks, on the surface, to be an issue with the SOAP request. Can you dump the full SOAP XML of the request for us to test?
Andrew Smith
Director, Technical Operations
Developer Forum Admin

alihumad
User
Posts: 12
Joined: Fri Apr 08, 2011 1:40 pm

Re: API Subscription Issue

Post by alihumad » Fri Jul 08, 2011 2:12 am

Is this what you mean?

Source File: c:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\7a2f26da\5f41d066\App_WebReferences.xphj91ft.0.cs Line: 1057

Stack Trace:


[SoapException: java.lang.NullPointerException]
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +443283
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +300
BullhornAPI.ApiService.eventsSubscribe(apiSession session, String subscriptionId, subscriptionCriteria criteria) in c:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\7a2f26da\5f41d066\App_WebReferences.xphj91ft.0.cs:1057
press_releases.createSubscription() in C:\hirestrategy_test\job_market\press_releases.aspx.vb:41
press_releases.Page_Load(Object sender, EventArgs e) in C:\hirestrategy_test\job_market\press_releases.aspx.vb:23
System.Web.UI.Control.OnLoad(EventArgs e) +133
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2604

---------------------------------------------------------

I don't know how to get the full SOAP XML of the request, can you tell me how I can do that if i'm not using XML, I'm using VB.NET script for API requests.

Thanks,
Humad

apsmith
Site Admin
Posts: 2051
Joined: Wed Dec 31, 1969 8:00 pm

Re: API Subscription Issue

Post by apsmith » Fri Jul 08, 2011 8:38 am

Humad,

Sorry, I was actually hoping for the actual XML. Understood that you are using VB, but your code eventuall needs to send a SOAP request to our servers.


Most often, users will simply dump the request to a text file before sending it.
Andrew Smith
Director, Technical Operations
Developer Forum Admin

alihumad
User
Posts: 12
Joined: Fri Apr 08, 2011 1:40 pm

Re: API Subscription Issue

Post by alihumad » Wed Jul 20, 2011 2:43 am

Hi,

Can you please show me how to dump my request to a text file before sending it? I tried different resources but couldn't find how to do this.

Thanks.

apsmith
Site Admin
Posts: 2051
Joined: Wed Dec 31, 1969 8:00 pm

Re: API Subscription Issue

Post by apsmith » Wed Jul 20, 2011 9:11 am

Ali,

Unfortunately, I cannot speak to how your code is setup to show you how to do this.

Looking back at your error, I am not sure, but you may be recieving this error due to not supplying the "entityEventTypes" attribute.

Please review the documentation here to make sure that you are properly supplying all necessary items.

http://developer.bullhorn.com/doc/versi ... scribe.htm
Andrew Smith
Director, Technical Operations
Developer Forum Admin

alihumad
User
Posts: 12
Joined: Fri Apr 08, 2011 1:40 pm

Re: API Subscription Issue

Post by alihumad » Thu Jul 21, 2011 2:12 am

Thanks, but I was told if you don't set the entityEventTypes, it will show you all the event Types (INSERTED, UPDATED, and DELETED). Anyway, I did try to set it up with the code below but it was throwing an error, seems like VB.NET doesn't like the type that is set in BullhornAPI and there doesn't seem to be a way of setting the types that doesn't throw an error. Please check it out and let me know what I'm doing wrong.

Dim myEntityEventTypes?(1) As entityEventType
myEntityEventTypes(0) = entityEventType.INSERTED
myEntityEventTypes(1) = entityEventType.UPDATED

' set up event subscription criteria
Dim criteria As New entityEventSubscriptionCriteria()
criteria.entityNames = entityList
criteria.entityEventTypes = myEntityEventTypes

This is part of the code that shows how I set up the entityEventTypes attribute and the error that is thrown is below:

Compiler Error Message: BC30037: Character is not valid.

Source Error:
Line 34: 'splitArray = entityList.Split(",")
Line 35:
Line 36: Dim myEntityEventTypes?(0) As entityEventType
Line 37: myEntityEventTypes(0) = entityEventType.INSERTED
Line 38: 'myEntityEventTypes(1) = entityEventType.UPDATED

Removing the ? also doesn't work with the BullhornAPI
Please advise.

jdonnelly
User
Posts: 192
Joined: Wed Feb 09, 2011 4:57 pm

Re: API Subscription Issue

Post by jdonnelly » Thu Jul 21, 2011 2:03 pm

Hello Alihumad,

A disclaimer - I am not a VB.NET developer, you may have better luck on a VB.NET forum as this issue is in compiling your code, not in the interaction with Bullhorn.

The exception "Compiler Error Message: BC30037: Character is not valid." seems straight forward - the question mark (?) is most likely not a valid character. Can you remove the character and try again?

Thanks,
Jon Donnelly
Technical Support Engineer
Developer Forum Admin
B U L L H O R N
support@bullhorn.com

alihumad
User
Posts: 12
Joined: Fri Apr 08, 2011 1:40 pm

Re: API Subscription Issue

Post by alihumad » Tue Aug 02, 2011 9:34 pm

Hi jdonnelly,

I read in one of the BH forums to use the question mark which is why I added it and if I remove it the code doesn't compile in the editor, so not sure how to fix. Is there anything else you can tell me about this issue?

Thanks.

jdonnelly
User
Posts: 192
Joined: Wed Feb 09, 2011 4:57 pm

Re: API Subscription Issue

Post by jdonnelly » Mon Aug 08, 2011 11:36 am

Hello Alihumad,

The exception that is produced when you include the question mark itself sounds like a compilation error (Compiler Error Message: BC30037: Character is not valid). Are you sure that you have the question mark in the correct position? Reading up on VB.NET, it looks like the question mark can be used to indicate that the object is nullable, but I have only seen the question mark used after the type - not after the variable name. What is the compilation error that you receive if you remove the question mark?

Also, can you provide all of your code? Or, a complete snippet that I could use to debug on my side as well?

Thanks,
Jon Donnelly
Technical Support Engineer
Developer Forum Admin
B U L L H O R N
support@bullhorn.com

Post Reply